_id
stringlengths 2
6
| title
stringlengths 9
130
| partition
stringclasses 3
values | text
stringlengths 30
4.3k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q2600
|
Regression.Base.covariance2
|
train
|
def covariance2(xs, ys)
raise "Length xs and ys must be equal" unless xs.length == ys.length
ev_x, ev_y = mean(xs), mean(ys)
xs.zip(ys)
|
ruby
|
{
"resource": ""
}
|
q2601
|
GeoElevation.Srtm.get_file_name
|
train
|
def get_file_name(latitude, longitude)
north_south = latitude >= 0 ? 'N' : 'S'
east_west = longitude >= 0 ? 'E' : 'W'
|
ruby
|
{
"resource": ""
}
|
q2602
|
GeoElevation.SrtmFile.get_elevation
|
train
|
def get_elevation(latitude, longitude)
if ! (@latitude <= latitude && latitude < @latitude + 1)
raise "Invalid latitude #{latitude} for file #{@file_name}"
end
if ! (@longitude <= longitude && longitude < @longitude + 1)
raise "Invalid longitude #{longitude} for file #{@file_name}"
|
ruby
|
{
"resource": ""
}
|
q2603
|
GeoElevation.Undulations.get_value_at_file_position
|
train
|
def get_value_at_file_position(position)
@file.seek(4 + position * 4)
bytes = @file.read(4)
begin
value = bytes[0].ord
|
ruby
|
{
"resource": ""
}
|
q2604
|
GeoElevation.Undulations.unpack
|
train
|
def unpack(n)
sign = n >> 31
exponent = (n >> (32 - 9)) & 0b11111111
value = n & 0b11111111111111111111111
resul = nil
if 1 <= exponent and exponent <= 254
|
ruby
|
{
"resource": ""
}
|
q2605
|
ChefRunDeck.State.add_state
|
train
|
def add_state(node, user, params)
# => Create a Node-State Object
(n = {}) && (n[:name] = node)
n[:created] = DateTime.now
n[:creator] = user
n[:type] = params['type']
|
ruby
|
{
"resource": ""
}
|
q2606
|
ChefRunDeck.State.delete_state
|
train
|
def delete_state(node)
# => Find the Node
existing = find_state(node)
return 'Node not present in state' unless existing
# => Delete the Node from State
|
ruby
|
{
"resource": ""
}
|
q2607
|
Somemoji.EmojiCollection.replace_character
|
train
|
def replace_character(string, &block)
string.gsub(character_pattern) do |character|
|
ruby
|
{
"resource": ""
}
|
q2608
|
Somemoji.EmojiCollection.replace_code
|
train
|
def replace_code(string, &block)
string.gsub(code_pattern) do |matched_string|
|
ruby
|
{
"resource": ""
}
|
q2609
|
Somemoji.EmojiCollection.search_by_code
|
train
|
def search_by_code(pattern)
self.class.new(
select do |emoji|
pattern ===
|
ruby
|
{
"resource": ""
}
|
q2610
|
Scorpion.Hunt.inject
|
train
|
def inject( object )
trip.object = object
object.send :scorpion_hunt=, self
object.injected_attributes.each do |attr|
|
ruby
|
{
"resource": ""
}
|
q2611
|
Scorpion.AttributeSet.define_attribute
|
train
|
def define_attribute( name, contract, **options )
|
ruby
|
{
"resource": ""
}
|
q2612
|
Pluginator::Extensions.PluginsMap.plugins_map
|
train
|
def plugins_map(type)
@plugins_map ||= {}
type = type.to_s
@plugins_map[type] ||=
|
ruby
|
{
"resource": ""
}
|
q2613
|
WebsocketGui.Base.run!
|
train
|
def run!(runtime_config = {})
@websocket_config.merge! runtime_config
EM.run do
if @websocket_config[:tick_interval]
EM.add_periodic_timer(@websocket_config[:tick_interval]) do
socket_trigger(:on_tick, @socket_connected)
end
end
EventMachine::WebSocket.run(host: @websocket_config[:socket_host], port: @websocket_config[:socket_port]) do |socket|
@socket_active = socket
socket.onopen do |handshake|
@socket_connected = true
socket_trigger(:on_socket_open, handshake)
end
socket.onmessage do |msg|
process_message(msg)
end
socket.onclose do
socket_trigger(:on_socket_close)
|
ruby
|
{
"resource": ""
}
|
q2614
|
Pluginator::Extensions.FirstClass.first_class!
|
train
|
def first_class!(type, klass)
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
klass = string2class(klass)
plugins_map(type)[klass] or
|
ruby
|
{
"resource": ""
}
|
q2615
|
ZerigoDNS::Resource.ClassMethods.process_response
|
train
|
def process_response response
without_root = response.body.values.first
case
when without_root.is_a?(Array) then process_array(response, without_root)
|
ruby
|
{
"resource": ""
}
|
q2616
|
Scorpion.Object.inject_from
|
train
|
def inject_from( dependencies, overwrite = false )
injected_attributes.each do |attr|
next unless dependencies.key? attr.name
|
ruby
|
{
"resource": ""
}
|
q2617
|
Scorpion.Object.inject_from!
|
train
|
def inject_from!( dependencies, overwrite = false )
injected_attributes.each do |attr|
next unless dependencies.key? attr.name
|
ruby
|
{
"resource": ""
}
|
q2618
|
ZerigoDNS::Resource::Attributes.InstanceMethods.method_missing
|
train
|
def method_missing mtd, *args
if mtd.to_s.chars.to_a.last == '='
raise ArgumentError, "Invalid number of arguments (#{args.length} for 1)" if args.length != 1
attributes[mtd.to_s.slice(0,mtd.to_s.length-1)] = args.first
|
ruby
|
{
"resource": ""
}
|
q2619
|
Beaglebone.AINPin.run_on_change
|
train
|
def run_on_change(callback, mv_change=10, interval=0.01, repeats=nil)
|
ruby
|
{
"resource": ""
}
|
q2620
|
Beaglebone.AINPin.run_on_threshold
|
train
|
def run_on_threshold(callback, mv_lower, mv_upper, mv_reset=10, interval=0.01,
|
ruby
|
{
"resource": ""
}
|
q2621
|
Beaglebone.AINPin.run_once_on_threshold
|
train
|
def run_once_on_threshold(callback, mv_lower, mv_upper, mv_reset=10, interval=0.01)
|
ruby
|
{
"resource": ""
}
|
q2622
|
DataMapper.Validation.validate
|
train
|
def validate(context_name = default_validation_context)
errors.clear
|
ruby
|
{
"resource": ""
}
|
q2623
|
Pluginator.Group.register_plugin
|
train
|
def register_plugin(type, klass)
type = type.to_s
@plugins[type]
|
ruby
|
{
"resource": ""
}
|
q2624
|
Scorpion.Hunter.find_dependency
|
train
|
def find_dependency( hunt )
dependency = dependency_map.find( hunt.contract )
dependency
|
ruby
|
{
"resource": ""
}
|
q2625
|
Pluginator::Extensions.FirstAsk.first_ask!
|
train
|
def first_ask!(type, method_name, *params)
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
|
ruby
|
{
"resource": ""
}
|
q2626
|
Beaglebone.GPIOPin.run_on_edge
|
train
|
def run_on_edge(callback, edge, timeout=nil, repeats=nil)
|
ruby
|
{
"resource": ""
}
|
q2627
|
ZerigoDNS::Resource::Naming.ClassMethods.default_resource_name
|
train
|
def default_resource_name
result = self.to_s.split("::").last.gsub(/([A-Z])/, '_\1').downcase
|
ruby
|
{
"resource": ""
}
|
q2628
|
Hdf5.H5Dataspace.offset_simple
|
train
|
def offset_simple(offsets)
raise ArgumentError.new("offsets should have ndims elements") unless offsets.size == ndims
|
ruby
|
{
"resource": ""
}
|
q2629
|
Rundeck.Request.api_token_header
|
train
|
def api_token_header(options, path = nil)
return nil if path == '/j_security_check'
unless @api_token
fail Error::MissingCredentials, 'Please set a api_token for user'
end
|
ruby
|
{
"resource": ""
}
|
q2630
|
Pluginator.NameConverter.name2class
|
train
|
def name2class(name)
klass = Kernel
name.to_s.split(%r{/}).each do |part|
|
ruby
|
{
"resource": ""
}
|
q2631
|
Scorpion.Stinger.sting!
|
train
|
def sting!( object )
return object unless scorpion
if object
assign_scorpion object
|
ruby
|
{
"resource": ""
}
|
q2632
|
Pluginator::Extensions.Matching.matching
|
train
|
def matching(type, list)
list.map do |plugin|
(plugins_map(type)
|
ruby
|
{
"resource": ""
}
|
q2633
|
Pluginator::Extensions.Matching.matching!
|
train
|
def matching!(type, list)
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
list.map do |plugin|
plugin = string2class(plugin)
|
ruby
|
{
"resource": ""
}
|
q2634
|
Rundeck.Client.objectify
|
train
|
def objectify(result)
if result.is_a?(Hash)
ObjectifiedHash.new(result)
elsif result.is_a?(Array)
|
ruby
|
{
"resource": ""
}
|
q2635
|
ZerigoDNS::Resource::Rest.ClassMethods.convert
|
train
|
def convert object
return {resource_name => object} if object.is_a? Hash
|
ruby
|
{
"resource": ""
}
|
q2636
|
ReqresRspec.Collector.sort
|
train
|
def sort
self.records.sort! do |x,y|
comp = x[:request][:symbolized_path] <=> y[:request][:symbolized_path]
|
ruby
|
{
"resource": ""
}
|
q2637
|
ReqresRspec.Collector.read_response_headers
|
train
|
def read_response_headers(response)
raw_headers = response.headers
headers = {}
EXCLUDE_RESPONSE_HEADER_PATTERNS.each do |pattern|
|
ruby
|
{
"resource": ""
}
|
q2638
|
ReqresRspec.Collector.get_symbolized_path
|
train
|
def get_symbolized_path(request)
request_path = (request.env['REQUEST_URI'] || request.path).dup
request_params =
request.env['action_dispatch.request.parameters'] ||
request.env['rack.request.form_hash'] ||
request.env['rack.request.query_hash']
if request_params
request_params
|
ruby
|
{
"resource": ""
}
|
q2639
|
Scorpion.DependencyMap.capture
|
train
|
def capture( contract, **options, &builder )
active_dependency_set.unshift Dependency::CapturedDependency.new( define_dependency( contract,
|
ruby
|
{
"resource": ""
}
|
q2640
|
Scorpion.DependencyMap.replicate_from
|
train
|
def replicate_from( other_map )
other_map.each do |dependency|
|
ruby
|
{
"resource": ""
}
|
q2641
|
Beaglebone.SPIDevice.xfer
|
train
|
def xfer(tx_data, readbytes=0, speed=nil, delay=nil,
|
ruby
|
{
"resource": ""
}
|
q2642
|
Rundeck.Configuration.options
|
train
|
def options
VALID_OPTIONS_KEYS.reduce({}) do |option, key|
|
ruby
|
{
"resource": ""
}
|
q2643
|
MessageMediaMessages.RepliesController.check_replies
|
train
|
def check_replies
# Prepare query url.
_path_url = '/v1/replies'
_query_builder = Configuration.base_uri.dup
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json'
|
ruby
|
{
"resource": ""
}
|
q2644
|
FitgemOauth2.Client.heartrate_time_series
|
train
|
def heartrate_time_series(start_date: nil, end_date: nil, period: nil)
warn '[DEPRECATION] `heartrate_time_series` is deprecated. Please use `hr_series_for_date_range` or `hr_series_for_period` instead.'
regular_time_series_guard(
start_date: start_date,
end_date: end_date,
|
ruby
|
{
"resource": ""
}
|
q2645
|
FitgemOauth2.Client.intraday_heartrate_time_series
|
train
|
def intraday_heartrate_time_series(start_date: nil, end_date: nil, detail_level: nil, start_time: nil, end_time: nil)
intraday_series_guard(
start_date: start_date,
end_date: end_date,
detail_level: detail_level,
start_time: start_time,
end_time: end_time
)
end_date = format_date(end_date) || '1d'
|
ruby
|
{
"resource": ""
}
|
q2646
|
MessageMediaMessages.FaradayClient.execute_as_string
|
train
|
def execute_as_string(http_request)
response = @connection.send(
http_request.http_method.downcase,
http_request.query_url
) do |request|
request.headers = http_request.headers
|
ruby
|
{
"resource": ""
}
|
q2647
|
MessageMediaMessages.FaradayClient.convert_response
|
train
|
def convert_response(response)
HttpResponse.new(response.status,
|
ruby
|
{
"resource": ""
}
|
q2648
|
RailsAdminClone.ModelCloner.clone_object
|
train
|
def clone_object(old_object)
object = build_from(old_object)
|
ruby
|
{
"resource": ""
}
|
q2649
|
RailsAdminClone.ModelCloner.clone_has_one
|
train
|
def clone_has_one(old_object, new_object)
old_object.class.reflect_on_all_associations(:has_one).each do |association|
old_association = old_object.send(association.name)
|
ruby
|
{
"resource": ""
}
|
q2650
|
RailsAdminClone.ModelCloner.clone_has_many
|
train
|
def clone_has_many(old_object, new_object)
associations = old_object.class.reflect_on_all_associations(:has_many)
.select{|a| !a.options.keys.include?(:through)}
associations.each do |association|
old_object.send(association.name).each do |old_association|
|
ruby
|
{
"resource": ""
}
|
q2651
|
WatirNokogiri.Button.text
|
train
|
def text
assert_exists
tn = @element.node_name.downcase
case tn
when 'input'
@element.get_attribute(:value)
when 'button'
@element.text
|
ruby
|
{
"resource": ""
}
|
q2652
|
FitgemOauth2.Client.intraday_activity_time_series
|
train
|
def intraday_activity_time_series(resource: nil, start_date: nil, end_date: nil, detail_level: nil,
start_time: nil, end_time: nil)
# converting to symbol to allow developer to use either 'calories' or :calories
resource = resource.to_sym
unless %i[calories steps distance floors elevation].include?(resource)
raise FitgemOauth2::InvalidArgumentError,
'Must specify resource to fetch intraday time series data for.'\
' One of (:calories, :steps, :distance, :floors, or :elevation) is required.'
end
|
ruby
|
{
"resource": ""
}
|
q2653
|
FitgemOauth2.Client.activity_list
|
train
|
def activity_list(date, sort, limit)
date_param = format_date(date)
if sort == "asc"
date_param = "afterDate=#{date_param}"
elsif sort == "desc"
date_param = "beforeDate=#{date_param}"
else
|
ruby
|
{
"resource": ""
}
|
q2654
|
FitgemOauth2.Client.update_activity_goals
|
train
|
def update_activity_goals(period, params)
unless period && %w(daily weekly).include?(period)
raise FitgemOauth2::InvalidArgumentError, "Goal period should either be 'daily' or 'weekly'"
|
ruby
|
{
"resource": ""
}
|
q2655
|
FitgemOauth2.Client.sleep_time_series
|
train
|
def sleep_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
unless start_date
raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.'
end
unless resource && SLEEP_RESOURCES.include?(resource)
raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{SLEEP_RESOURCES}."
|
ruby
|
{
"resource": ""
}
|
q2656
|
WatirNokogiri.Option.text
|
train
|
def text
assert_exists
# A little unintuitive - we'll return the 'label' or 'text' attribute if
# they exist, otherwise the inner text of the element
attribute = [:label, :text].find {
|
ruby
|
{
"resource": ""
}
|
q2657
|
WatirNokogiri.Element.style
|
train
|
def style(property = nil)
assert_exists
styles = attribute_value('style').to_s.strip
if property
properties
|
ruby
|
{
"resource": ""
}
|
q2658
|
WatirNokogiri.Element.parent
|
train
|
def parent
assert_exists
e = @element.parent
if e.kind_of?(Nokogiri::XML::Element)
|
ruby
|
{
"resource": ""
}
|
q2659
|
DhtSensor.App.to_hash
|
train
|
def to_hash(val)
if @options[:humidity] then
return {"humidity" => val.humidity}
end
if @options[:unit] == :c then
if @options[:temperature] then
return {"temperature" => val.temp}
else
return {"temperature" => val.temp, "humidity" => val.humidity}
end
|
ruby
|
{
"resource": ""
}
|
q2660
|
DhtSensor.App.print
|
train
|
def print(val)
if @options[:humidity] then
puts sprintf("Humidity: %.2f%%", val.humidity)
return
end
if @options[:unit] == :c then
if @options[:temperature] then
puts sprintf("Temperature: %.2f C", val.temp)
|
ruby
|
{
"resource": ""
}
|
q2661
|
WatirNokogiri.CellContainer.cell
|
train
|
def cell(*args)
cell = TableCell.new(self, extract_selector(args).merge(:tag_name
|
ruby
|
{
"resource": ""
}
|
q2662
|
WatirNokogiri.CellContainer.cells
|
train
|
def cells(*args)
cells = TableCellCollection.new(self, extract_selector(args).merge(:tag_name
|
ruby
|
{
"resource": ""
}
|
q2663
|
MessageMediaMessages.BaseModel.to_hash
|
train
|
def to_hash
hash = {}
instance_variables.each do |name|
value = instance_variable_get(name)
next if value.nil?
name = name[1..-1]
key = self.class.names.key?(name) ? self.class.names[name] : name
if value.instance_of? Array
|
ruby
|
{
"resource": ""
}
|
q2664
|
WatirNokogiri.Document.goto
|
train
|
def goto(file_path)
html = File.read(file_path)
|
ruby
|
{
"resource": ""
}
|
q2665
|
Titlekit.Job.run
|
train
|
def run
@wants.each do |want|
@haves.each do |have|
import(have)
retime(have, want)
cull(have)
group(have)
want.subtitles += have.subtitles.clone
end
|
ruby
|
{
"resource": ""
}
|
q2666
|
Titlekit.Job.cull
|
train
|
def cull(have)
have.subtitles.reject! { |subtitle| subtitle[:end] < 0 }
have.subtitles.each do |subtitle|
|
ruby
|
{
"resource": ""
}
|
q2667
|
Titlekit.Job.retime_by_framerate
|
train
|
def retime_by_framerate(have, want)
ratio = want.fps.to_f / have.fps.to_f
|
ruby
|
{
"resource": ""
}
|
q2668
|
MessageMediaMessages.HttpClient.get
|
train
|
def get(query_url,
headers: {})
HttpRequest.new(HttpMethodEnum::GET,
|
ruby
|
{
"resource": ""
}
|
q2669
|
MessageMediaMessages.HttpClient.head
|
train
|
def head(query_url,
headers: {})
HttpRequest.new(HttpMethodEnum::HEAD,
|
ruby
|
{
"resource": ""
}
|
q2670
|
MessageMediaMessages.HttpClient.post
|
train
|
def post(query_url,
headers: {},
parameters: {})
HttpRequest.new(HttpMethodEnum::POST,
query_url,
|
ruby
|
{
"resource": ""
}
|
q2671
|
MessageMediaMessages.HttpClient.put
|
train
|
def put(query_url,
headers: {},
parameters: {})
HttpRequest.new(HttpMethodEnum::PUT,
query_url,
|
ruby
|
{
"resource": ""
}
|
q2672
|
MessageMediaMessages.HttpClient.patch
|
train
|
def patch(query_url,
headers: {},
parameters: {})
HttpRequest.new(HttpMethodEnum::PATCH,
query_url,
|
ruby
|
{
"resource": ""
}
|
q2673
|
MessageMediaMessages.HttpClient.delete
|
train
|
def delete(query_url,
headers: {},
parameters: {})
HttpRequest.new(HttpMethodEnum::DELETE,
query_url,
|
ruby
|
{
"resource": ""
}
|
q2674
|
Capistrano.LogWithAwesome.log
|
train
|
def log(level, message, line_prefix=nil)
if level <= self.level
indent = "%*s" % [Capistrano::Logger::MAX_LEVEL, "*" * (Capistrano::Logger::MAX_LEVEL - level)]
(RUBY_VERSION >= "1.9" ? message.lines : message).each do |line|
if line_prefix
self.class.log_with_awesome "#{indent} [#{line_prefix}] #{line.strip}"
|
ruby
|
{
"resource": ""
}
|
q2675
|
ActsAsFerret.ClassMethods.records_for_rebuild
|
train
|
def records_for_rebuild(batch_size = 1000)
transaction do
if use_fast_batches?
offset = 0
while (rows = where([ "#{table_name}.id > ?", offset ]).limit(batch_size).all).any?
|
ruby
|
{
"resource": ""
}
|
q2676
|
ActsAsFerret.ClassMethods.records_for_bulk_index
|
train
|
def records_for_bulk_index(ids, batch_size = 1000)
transaction do
offset = 0
ids.each_slice(batch_size) do |id_slice|
records = where(:id => id_slice).all
#yield records, offset
|
ruby
|
{
"resource": ""
}
|
q2677
|
Sorcerer.Subexpression.within_method_sexp
|
train
|
def within_method_sexp(sexp)
case sexp.first
when :call # [:call, target, ".", meth]
recur(sexp[1])
when :method_add_block # [:method_add_block, call, block]
within_method_sexp(sexp[1])
|
ruby
|
{
"resource": ""
}
|
q2678
|
Brice.Colours.enable_irb
|
train
|
def enable_irb
IRB::Inspector.class_eval {
unless method_defined?(:inspect_value_with_colour)
alias_method :inspect_value_without_colour, :inspect_value
def inspect_value_with_colour(value)
|
ruby
|
{
"resource": ""
}
|
q2679
|
Brice.Colours.colourize
|
train
|
def colourize(str)
''.tap { |res| Tokenizer.tokenize(str.to_s) { |token, value|
res << colourize_string(value, colours[token])
} }
|
ruby
|
{
"resource": ""
}
|
q2680
|
GScraper.HasPages.each_page
|
train
|
def each_page(indices)
unless block_given?
enum_for(:each_page,indices)
|
ruby
|
{
"resource": ""
}
|
q2681
|
GScraper.HasPages.each
|
train
|
def each
return enum_for(:each) unless block_given?
index = 1
until ((next_page = page_cache[index]).empty?) do
|
ruby
|
{
"resource": ""
}
|
q2682
|
GScraper.HasPages.page_cache
|
train
|
def page_cache
@page_cache ||= Hash.new { |hash,key|
|
ruby
|
{
"resource": ""
}
|
q2683
|
ActsAsFerret.AbstractIndex.change_index_dir
|
train
|
def change_index_dir(new_dir)
logger.debug "[#{index_name}] changing index dir to #{new_dir}"
index_definition[:index_dir] = index_definition[:ferret][:path] = new_dir
|
ruby
|
{
"resource": ""
}
|
q2684
|
XCRes::XCAssets.Bundle.read
|
train
|
def read
@resource_paths = Dir.chdir(path) do
Dir['**/Contents.json'].map { |p| Pathname(p) + '..' }
end
@resources =
|
ruby
|
{
"resource": ""
}
|
q2685
|
XCRes.StringsAnalyzer.build_section
|
train
|
def build_section
selected_file_refs = selected_strings_file_refs
# Apply ignore list
file_paths = filter_exclusions(selected_file_refs.map(&:path))
filtered_file_refs = selected_file_refs.select { |file_ref| file_paths.include? file_ref.path }
|
ruby
|
{
"resource": ""
}
|
q2686
|
XCRes.StringsAnalyzer.info_plist_paths
|
train
|
def info_plist_paths
@info_plist_paths ||= target.build_configurations.map do |config|
|
ruby
|
{
"resource": ""
}
|
q2687
|
XCRes.StringsAnalyzer.native_dev_languages
|
train
|
def native_dev_languages
@native_dev_languages ||= absolute_info_plist_paths.map do |path|
begin
read_plist_key(path, :CFBundleDevelopmentRegion)
|
ruby
|
{
"resource": ""
}
|
q2688
|
XCRes.StringsAnalyzer.keys_by_file
|
train
|
def keys_by_file(path)
begin
# Load strings file contents
strings = read_strings_file(path)
# Reject generated identifiers used by Interface Builder
strings.reject! { |key, _| /^[a-zA-Z0-9]{3}-[a-zA-Z0-9]{2,3}-[a-zA-Z0-9]{3}/.match(key) }
keys = Hash[strings.map do |key, value|
[key, { value: key, comment: value.gsub(/[\r\n]/, ' ') }]
|
ruby
|
{
"resource": ""
}
|
q2689
|
ActsAsFerret.InstanceMethods.ferret_enabled?
|
train
|
def ferret_enabled?(is_bulk_index = false)
@ferret_disabled.nil? && (is_bulk_index
|
ruby
|
{
"resource": ""
}
|
q2690
|
JMX.RubyNotificationEmitter.removeNotificationListener
|
train
|
def removeNotificationListener(listener, filter=nil, handback=nil)
found = false
listeners.delete_if do |clistener, (cfilter, chandback)|
|
ruby
|
{
"resource": ""
}
|
q2691
|
JMX.MBeanProxy.[]
|
train
|
def [](name)
attribute = @server.getAttribute(@object_name, name.to_s)
return attribute.value if
|
ruby
|
{
"resource": ""
}
|
q2692
|
JMX.MBeanProxy.[]=
|
train
|
def []=(name, value)
@server.setAttribute
|
ruby
|
{
"resource": ""
}
|
q2693
|
JMX.MBeanProxy.invoke
|
train
|
def invoke(name, *params)
op = @info.operations.find { |o| o.name == name.to_s }
raise NoMethodError.new("No such
|
ruby
|
{
"resource": ""
}
|
q2694
|
JMX.MBeanProxy.java_types
|
train
|
def java_types(params)
return nil if params.nil?
params.map {|e|
|
ruby
|
{
"resource": ""
}
|
q2695
|
Apkstats::Command.Executable.compare_with
|
train
|
def compare_with(apk_filepath, other_apk_filepath)
base = Apkstats::Entity::ApkInfo.new(self, apk_filepath)
other = Apkstats::Entity::ApkInfo.new(self,
|
ruby
|
{
"resource": ""
}
|
q2696
|
XCRes.Analyzer.new_section
|
train
|
def new_section(name, data, options={})
XCRes::Section.new(name, data,
|
ruby
|
{
"resource": ""
}
|
q2697
|
XCRes.Analyzer.filter_exclusions
|
train
|
def filter_exclusions file_paths
file_paths.reject do |path|
exclude_file_patterns.any?
|
ruby
|
{
"resource": ""
}
|
q2698
|
XCRes.Analyzer.find_file_refs_by_extname
|
train
|
def find_file_refs_by_extname(extname)
project.files.select do |file_ref|
|
ruby
|
{
"resource": ""
}
|
q2699
|
XCRes.Analyzer.resources_files
|
train
|
def resources_files
target.resources_build_phase.files.map do |build_file|
if build_file.file_ref.is_a?(Xcodeproj::Project::Object::PBXGroup)
|
ruby
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.