_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q2700 | MongoidShortener.ShortenedUrlsController.translate | train | def translate
# pull the link out of the db
sl = ShortenedUrl.where(:unique_key => params[:unique_key][1..-1]).first
if sl
sl.inc(:use_count, 1)
# do a 301 redirect to the destination url
head :moved_permanently, :location => sl.url
else
# if we don't | ruby | {
"resource": ""
} |
q2701 | ActsAsFerret.ActMethods.acts_as_ferret | train | def acts_as_ferret(options={})
extend ClassMethods
include InstanceMethods
include MoreLikeThis::InstanceMethods
if options[:rdig]
cattr_accessor :rdig_configuration
self.rdig_configuration = options[:rdig]
require 'rdig_adapter'
include ActsAsFerret::RdigAdapt... | ruby | {
"resource": ""
} |
q2702 | ActsAsFerret.ActMethods.define_to_field_method | train | def define_to_field_method(field, options = {})
method_name = "#{field}_to_ferret"
return if instance_methods.include?(method_name) # already defined
aaf_configuration[:defined_fields] ||= {}
aaf_configuration[:defined_fields][field] = options
dynamic_boost = options[:boost] if options[:bo... | ruby | {
"resource": ""
} |
q2703 | Minke.Command.create_dependencies | train | def create_dependencies task
project_name = "minke#{SecureRandom.urlsafe_base64(12)}".downcase.gsub(/[^0-9a-z ]/i, '')
network_name = ENV['DOCKER_NETWORK'] ||= "#{project_name}_default"
ENV['DOCKER_PROJECT'] = project_name
ENV['DOCKER_NETWORK'] = network_name
logger = Minke::Logging.creat... | ruby | {
"resource": ""
} |
q2704 | Rapinoe.Slide.write_preview_to_file | train | def write_preview_to_file(path)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'wb') do | ruby | {
"resource": ""
} |
q2705 | Gemnasium.Configuration.is_valid? | train | def is_valid?
site_option_valid = !site.nil? && !site.empty?
api_key_option_valid = !api_key.nil? && !api_key.empty?
use_ssl_option_valid = !use_ssl.nil? && !!use_ssl == use_ssl # Check this is a boolean
api_version_option_valid = !api_version.nil? && !... | ruby | {
"resource": ""
} |
q2706 | GScraper.SponsoredLinks.ads_with_title | train | def ads_with_title(title)
return enum_for(:ads_with_title,title) unless block_given?
comparitor = if title.kind_of?(Regexp)
lambda { |ad| ad.title =~ title }
else
lambda { |ad| ad.title == title }
end
| ruby | {
"resource": ""
} |
q2707 | GScraper.SponsoredLinks.ads_with_url | train | def ads_with_url(url)
return enum_for(:ads_with_url,url) unless block_given?
comparitor = if url.kind_of?(Regexp)
lambda { |ad| ad.url =~ url }
else
lambda { |ad| ad.url == url }
end
| ruby | {
"resource": ""
} |
q2708 | GScraper.SponsoredLinks.ads_with_direct_url | train | def ads_with_direct_url(direct_url)
return enum_for(:ads_with_direct_url,direct_url) unless block_given?
comparitor = if direct_url.kind_of?(Regexp)
lambda { |ad| ad.direct_url =~ | ruby | {
"resource": ""
} |
q2709 | Rapinoe.Keynote.aspect_ratio | train | def aspect_ratio
path = "/tmp/rapinoe-aspect"
write_preview_to_file(path)
dimensions = FastImage.size(path)
widescreen = (16/9.0)
if widescreen | ruby | {
"resource": ""
} |
q2710 | Rapinoe.Keynote.colors | train | def colors
return @colors if @colors
path = "/tmp/rapinoe-aspect"
write_preview_to_file(path)
colors = Miro::DominantColors.new(path)
by_percentage = colors.by_percentage
hash | ruby | {
"resource": ""
} |
q2711 | XCRes::XCAssets.ResourceImage.read | train | def read(hash)
self.scale = hash.delete('scale').sub(/x$/, '').to_i unless hash['scale'].nil?
KNOWN_KEYS.each do |key|
value = hash.delete(key.to_s.dasherize)
| ruby | {
"resource": ""
} |
q2712 | XCRes::XCAssets.ResourceImage.to_hash | train | def to_hash
hash = {}
hash['scale'] = "#{scale}x" unless scale.nil?
(KNOWN_KEYS - [:scale]).each do |key|
value = self.send(key)
hash[key.to_s.dasherize] = value.to_s unless value.nil?
| ruby | {
"resource": ""
} |
q2713 | XCRes.AggregateAnalyzer.add_with_class | train | def add_with_class(analyzer_class, options={})
analyzer = analyzer_class.new(target, self.options.merge(options))
| ruby | {
"resource": ""
} |
q2714 | Lieu.Request.post | train | def post(path, options={})
response = request(:post, path, options)
response.delete(:status) | ruby | {
"resource": ""
} |
q2715 | MongoidShortener.ShortenedUrlsHelper.shortened_url | train | def shortened_url(url)
raise "Only String accepted: #{url}" unless url.class == String
| ruby | {
"resource": ""
} |
q2716 | ActsAsFerret.LocalIndex.ferret_index | train | def ferret_index
ensure_index_exists
(@ferret_index ||= Ferret::Index::Index.new(index_definition[:ferret])).tap do |idx|
| ruby | {
"resource": ""
} |
q2717 | ActsAsFerret.LocalIndex.rebuild_index | train | def rebuild_index
models = index_definition[:registered_models]
logger.debug "rebuild index with models: #{models.inspect}"
close
index = Ferret::Index::Index.new(index_definition[:ferret].dup.update(:auto_flush => false,
| ruby | {
"resource": ""
} |
q2718 | ActsAsFerret.LocalIndex.process_query | train | def process_query(query, options = {})
return query unless String === query
ferret_index.synchronize do
if options[:analyzer]
# use per-query analyzer if present
qp = Ferret::QueryParser.new ferret_index.instance_variable_get('@options').merge(options)
reader = ferret_i... | ruby | {
"resource": ""
} |
q2719 | ActsAsFerret.LocalIndex.total_hits | train | def total_hits(query, options = {})
ferret_index.search(process_query(query, | ruby | {
"resource": ""
} |
q2720 | ActsAsFerret.LocalIndex.highlight | train | def highlight(key, query, options = {})
logger.debug("highlight: #{key} query: #{query}")
options.reverse_merge! :num_excerpts => 2, :pre_tag => '<em>', :post_tag => '</em>'
highlights = []
ferret_index.synchronize do
doc_num = document_number(key)
if options[:field]
h... | ruby | {
"resource": ""
} |
q2721 | ActsAsFerret.LocalIndex.document_number | train | def document_number(key)
docnum = ferret_index.doc_number(key)
# hits = ferret_index.search query_for_record(key)
# return hits.hits.first.doc if hits.total_hits == 1
| ruby | {
"resource": ""
} |
q2722 | SocialMedia::Service.Facebook.get_app_access_token | train | def get_app_access_token
return connection_params[:app_access_token] if connection_params.has_key? :app_access_token
@oauth = Koala::Facebook::OAuth.new(connection_params[:app_id], | ruby | {
"resource": ""
} |
q2723 | ESP.Suppression.regions | train | def regions
# When regions come back in an include, the method still gets called, to return the object from the attributes.
| ruby | {
"resource": ""
} |
q2724 | ESP.Suppression.external_accounts | train | def external_accounts
# When external_accounts come back in an include, the method still gets called, to return the object from the attributes.
return attributes['external_accounts'] if attributes['external_accounts'].present?
return [] | ruby | {
"resource": ""
} |
q2725 | ESP.Suppression.signatures | train | def signatures
# When signatures come back in an include, the method still gets called, to return the object from the attributes.
| ruby | {
"resource": ""
} |
q2726 | ESP.Suppression.custom_signatures | train | def custom_signatures
# When custom_signatures come back in an include, the method still gets called, to return the object from the attributes.
return attributes['custom_signatures'] if attributes['custom_signatures'].present?
return [] | ruby | {
"resource": ""
} |
q2727 | ESP.Region.suppress | train | def suppress(arguments = {})
arguments = arguments.with_indifferent_access
ESP::Suppression::Region.create(regions: [code], external_account_ids: | ruby | {
"resource": ""
} |
q2728 | Tolaria.HelpLink.validate! | train | def validate!
if title.blank?
raise RuntimeError, "HelpLinks must provide a string title"
end
file_configured = (slug.present? && markdown_file.present?)
link_configured = link_to.present?
unless file_configured || link_configured
raise RuntimeError, "Incomplete HelpLink... | ruby | {
"resource": ""
} |
q2729 | Jabber.Bot.presence | train | def presence(presence=nil, status=nil, priority=nil)
@config[:presence] = presence
@config[:status] = status
@config[:priority] = priority
status_message | ruby | {
"resource": ""
} |
q2730 | Jabber.Bot.add_command_alias | train | def add_command_alias(command_name, alias_command, callback) #:nodoc:
original_command = @commands[:meta][command_name]
original_command[:syntax] << alias_command[:syntax]
alias_name = command_name(alias_command[:syntax])
alias_command[:is_public] | ruby | {
"resource": ""
} |
q2731 | Jabber.Bot.add_command_meta | train | def add_command_meta(name, command, is_alias=false) #:nodoc:
syntax = command[:syntax]
@commands[:meta][name] = {
:syntax => syntax.is_a?(Array) ? syntax : [syntax],
| ruby | {
"resource": ""
} |
q2732 | Jabber.Bot.help_message | train | def help_message(sender, command_name) #:nodoc:
if command_name.nil? || command_name.length == 0
# Display help for all commands
help_message = "I understand the following commands:\n\n"
@commands[:meta].sort.each do |command|
# Thank you, Hash.sort
command = command[1... | ruby | {
"resource": ""
} |
q2733 | Jabber.Bot.start_listener_thread | train | def start_listener_thread #:nodoc:
listener_thread = Thread.new do
loop do
if @jabber.received_messages?
@jabber.received_messages do |message|
# Remove the Jabber resourse, if any
sender = | ruby | {
"resource": ""
} |
q2734 | EPP.Server.prepare_request | train | def prepare_request(command, extension = nil)
cmd = EPP::Requests::Command.new(req_tid, | ruby | {
"resource": ""
} |
q2735 | EPP.Server.connection | train | def connection
@connection_errors = []
addrinfo.each do |_,port,_,addr,_,_,_|
retried = false
begin
@conn = TCPSocket.new(addr, port)
rescue Errno::EINVAL => e
if retried
message = e.message.split(" - ")[1]
@connection_errors << Errno::EINV... | ruby | {
"resource": ""
} |
q2736 | EPP.Server.send_frame | train | def send_frame(xml)
xml = xml.to_s if xml.kind_of?(Request) | ruby | {
"resource": ""
} |
q2737 | EPP.Server.recv_frame | train | def recv_frame
header = @sock.read(HEADER_LEN)
if header.nil? && @sock.eof?
raise ServerError, "Connection terminated by remote host"
elsif header.nil?
raise ServerError, "Failed to read header from remote host"
else
len = header.unpack('N')[0]
| ruby | {
"resource": ""
} |
q2738 | Tolaria.MarkdownRendererProxy.render | train | def render(document)
if Tolaria.config.markdown_renderer.nil?
return simple_format(document)
| ruby | {
"resource": ""
} |
q2739 | ProblemChild.Helpers.base_sha | train | def base_sha
default_branch = client.repo(repo)[:default_branch]
branches.find { |branch| | ruby | {
"resource": ""
} |
q2740 | ProblemChild.Helpers.patch_branch | train | def patch_branch
num = 1
branch_name = form_data['title'].parameterize
return branch_name unless branch_exists?(branch_name)
| ruby | {
"resource": ""
} |
q2741 | ProblemChild.Helpers.create_pull_request | train | def create_pull_request
unless uploads.empty?
branch = patch_branch
create_branch(branch)
uploads.each do |key, upload|
client.create_contents(
repo,
upload[:filename],
| ruby | {
"resource": ""
} |
q2742 | Runfile.ExecHandler.run | train | def run(cmd)
cmd = @before_run_block.call(cmd) if @before_run_block
return false unless cmd
say "!txtgrn!> #{cmd}" unless Runfile.quiet
| ruby | {
"resource": ""
} |
q2743 | Runfile.ExecHandler.run! | train | def run!(cmd)
cmd = @before_run_block.call(cmd) if @before_run_block
| ruby | {
"resource": ""
} |
q2744 | Runfile.ExecHandler.run_bg | train | def run_bg(cmd, pid: nil, log: '/dev/null')
cmd = @before_run_block.call(cmd) if @before_run_block
return false unless cmd
full_cmd = "exec #{cmd} >#{log} 2>&1"
| ruby | {
"resource": ""
} |
q2745 | Runfile.ExecHandler.stop_bg | train | def stop_bg(pid)
file = pidfile(pid)
if File.exist? file
pid = File.read file
| ruby | {
"resource": ""
} |
q2746 | ESP.Console.start | train | def start # rubocop:disable Metrics/MethodLength
ARGV.clear
IRB.setup nil
IRB.conf[:PROMPT] = {}
IRB.conf[:IRB_NAME] = 'espsdk'
IRB.conf[:PROMPT][:ESPSDK] = {
PROMPT_I: '%N:%03n:%i> ',
PROMPT_N: '%N:%03n:%i> ',
PROMPT_S: '%N:%03n:%i%l ',
PRO... | ruby | {
"resource": ""
} |
q2747 | EPP.XMLHelpers.epp_namespace | train | def epp_namespace(node, name = nil, namespaces = {})
return namespaces['epp'] | ruby | {
"resource": ""
} |
q2748 | EPP.XMLHelpers.epp_node | train | def epp_node(name, value = nil, namespaces = {})
value, namespaces = nil, value if value.kind_of?(Hash)
| ruby | {
"resource": ""
} |
q2749 | EPP.XMLHelpers.xml_namespace | train | def xml_namespace(node, name, uri, namespaces | ruby | {
"resource": ""
} |
q2750 | EPP.XMLHelpers.xml_document | train | def xml_document(obj)
case obj
when XML::Document
| ruby | {
"resource": ""
} |
q2751 | Vanguard.DSL.method_missing | train | def method_missing(method_name, *arguments)
klass = REGISTRY.fetch(method_name) { super }
| ruby | {
"resource": ""
} |
q2752 | Cliqr.Interface.execute | train | def execute(args = [], **options)
execute_internal(args, options)
Executor::ExitCode.code(:success)
| ruby | {
"resource": ""
} |
q2753 | Cliqr.Interface.execute_internal | train | def execute_internal(args = [], **options)
options = {
output: :default, | ruby | {
"resource": ""
} |
q2754 | Cliqr.InterfaceBuilder.build | train | def build
raise Cliqr::Error::ConfigNotFound, 'a valid config should be defined' if @config.nil?
unless @config.valid?
raise Cliqr::Error::ValidationError, \
| ruby | {
"resource": ""
} |
q2755 | Runfile.Runner.execute | train | def execute(argv, filename='Runfile')
@ignore_settings = !filename
argv = expand_shortcuts argv
filename and File.file?(filename) or handle_no_runfile argv
begin
load settings.helper if settings.helper
load filename
| ruby | {
"resource": ""
} |
q2756 | Runfile.Runner.add_action | train | def add_action(name, altname=nil, &block)
if @last_usage.nil?
@last_usage = altname ? "(#{name}|#{altname})" : name
end
[@namespace, @superspace].each do |prefix|
prefix or next
name = "#{prefix}_#{name}"
@last_usage = "#{prefix} #{last_usage}" unless @last_usage == fa... | ruby | {
"resource": ""
} |
q2757 | Runfile.Runner.add_option | train | def add_option(flag, text, scope=nil)
scope or scope = 'Options'
@options[scope] | ruby | {
"resource": ""
} |
q2758 | Runfile.Runner.add_param | train | def add_param(name, text, scope=nil)
scope or scope = 'Parameters'
@params[scope] | ruby | {
"resource": ""
} |
q2759 | Runfile.Runner.run | train | def run(*argv)
begin
docopt_exec argv
rescue Docopt::Exit => ex
| ruby | {
"resource": ""
} |
q2760 | ActiveResource.Validations.load_remote_errors | train | def load_remote_errors(remote_errors, save_cache = false)
if self.class.format == ActiveResource::Formats::JsonAPIFormat
| ruby | {
"resource": ""
} |
q2761 | Slugalicious.ClassMethods.find_from_slug_path | train | def find_from_slug_path(path)
slug = path.split('/').last
scope = path[0..(-(slug.size | ruby | {
"resource": ""
} |
q2762 | Oxblood.Pipeline.sync | train | def sync
serialized_commands = @commands.map { |c| Protocol.build_command(*c) }
connection.socket.write(serialized_commands.join)
| ruby | {
"resource": ""
} |
q2763 | LonoCfn.Base.get_source_path | train | def get_source_path(path, type)
default_convention_path = convention_path(@stack_name, type)
return default_convention_path if path.nil?
# convention | ruby | {
"resource": ""
} |
q2764 | LonoCfn.Base.detect_format | train | def detect_format
formats = Dir.glob("#{@project_root}/output/**/*").map { |path| path }.
reject { |s| s =~ %r{/params/} }. # reject output/params folder
map { |path| File.extname(path) }.
| ruby | {
"resource": ""
} |
q2765 | ActiveResource.PaginatedCollection.page | train | def page(page_number = nil)
fail ArgumentError, "You must supply a page number." unless page_number.present?
fail ArgumentError, "Page number cannot be less than 1." if page_number.to_i < 1
fail ArgumentError, "Page number cannot be greater than the last page number." if page_number.to_i > last_page_n... | ruby | {
"resource": ""
} |
q2766 | Runfile.RunfileHelper.make_runfile | train | def make_runfile(name=nil)
name = 'Runfile' if name.nil?
template = File.expand_path("../templates/Runfile", __FILE__)
name += ".runfile" unless name == | ruby | {
"resource": ""
} |
q2767 | Runfile.RunfileHelper.show_make_help | train | def show_make_help(runfiles, compact=false)
say "!txtpur!Runfile engine v#{Runfile::VERSION}" unless compact
if runfiles.size < 3 and !compact
say "\nTip: Type '!txtblu!run new!txtrst!' or '!txtblu!run new name!txtrst!' to create a runfile.\nFor global access, place !txtblu!named.runfiles!txtrst! in... | ruby | {
"resource": ""
} |
q2768 | Runfile.RunfileHelper.say_runfile_list | train | def say_runfile_list(runfiles)
runfile_paths = runfiles.map { |f| File.dirname f }
max = runfile_paths.max_by(&:length).size
width = detect_terminal_size[0]
runfiles.each do |f|
f[/([^\/]+).runfile$/]
command = "run #{$1}"
spacer_size = width - | ruby | {
"resource": ""
} |
q2769 | Runfile.RunfileHelper.say_runfile_usage | train | def say_runfile_usage(runfiles)
runfiles_as_columns = get_runfiles_as_columns runfiles
say "#{settings.intro}\n" if settings.intro
say "Usage: run <file>"
| ruby | {
"resource": ""
} |
q2770 | Runfile.RunfileHelper.show_shortcuts | train | def show_shortcuts
say "\nShortcuts:"
max = settings.shortcuts.keys.max_by(&:length).length
settings.shortcuts.each_pair do |shortcut, | ruby | {
"resource": ""
} |
q2771 | Runfile.RunfileHelper.get_runfiles_as_columns | train | def get_runfiles_as_columns(runfiles)
namelist = runfile_names runfiles
width = detect_terminal_size[0]
max = namelist.max_by(&:length).length
message = " | ruby | {
"resource": ""
} |
q2772 | ESP.Resource.serializable_hash | train | def serializable_hash(*)
h = attributes.extract!('included')
h['data'] = { 'type' => self.class.to_s.underscore.sub('esp/', '').pluralize,
| ruby | {
"resource": ""
} |
q2773 | Oxblood.Pool.with | train | def with
conn = @pool.checkout
session = Session.new(conn)
yield(session)
ensure
if conn
| ruby | {
"resource": ""
} |
q2774 | Runfile.DocoptHelper.docopt_usage | train | def docopt_usage
doc = ["\nUsage:"];
@actions.each do |_name, action|
doc << " run #{action.usage}" unless action.usage == false
end
basic_flags = @version ? "(-h|--help|--version)" : "(-h|--help)"
if @superspace
doc << " | ruby | {
"resource": ""
} |
q2775 | Runfile.DocoptHelper.docopt_commands | train | def docopt_commands(width)
doc = []
caption_printed = false
@actions.each do |_name, action|
action.help or next
doc << "Commands:" unless caption_printed
caption_printed = true
helpline = " #{action.help}"
| ruby | {
"resource": ""
} |
q2776 | Runfile.DocoptHelper.docopt_examples | train | def docopt_examples(width)
return [] if @examples.empty?
doc = ["Examples:"]
base_command = @superspace ? "run #{@superspace}" : "run"
@examples.each do |command|
| ruby | {
"resource": ""
} |
q2777 | Tolaria.FormBuildable.hint | train | def hint(hint_text, options = {})
css_class = "hint #{options.delete(:class)}" | ruby | {
"resource": ""
} |
q2778 | Tolaria.FormBuildable.image_association_select | train | def image_association_select(method, collection, value_method, text_method, preview_url_method, options = {})
render(partial:"admin/shared/forms/image_association_select", locals: {
f: self,
method: method,
collection: collection,
| ruby | {
"resource": ""
} |
q2779 | Tolaria.FormBuildable.markdown_composer | train | def markdown_composer(method, options = {})
render(partial:"admin/shared/forms/markdown_composer", locals: {
f: self,
| ruby | {
"resource": ""
} |
q2780 | Tolaria.FormBuildable.attachment_field | train | def attachment_field(method, options = {})
render(partial:"admin/shared/forms/attachment_field", locals: {
f: self,
| ruby | {
"resource": ""
} |
q2781 | Tolaria.FormBuildable.image_field | train | def image_field(method, options = {})
render(partial:"admin/shared/forms/image_field", locals: { | ruby | {
"resource": ""
} |
q2782 | Tolaria.FormBuildable.timestamp_field | train | def timestamp_field(method, options = {})
render(partial:"admin/shared/forms/timestamp_field", locals: {
f: self,
| ruby | {
"resource": ""
} |
q2783 | Tolaria.FormBuildable.slug_field | train | def slug_field(method, options = {})
pattern = options.delete(:pattern)
preview_value = self.object.send(method).try(:parameterize).presence || "*"
render(partial:"admin/shared/forms/slug_field", locals: {
f: self,
method: method,
| ruby | {
"resource": ""
} |
q2784 | Tolaria.FormBuildable.swatch_field | train | def swatch_field(method, options = {})
render(partial:"admin/shared/forms/swatch_field", locals: {
f: self,
| ruby | {
"resource": ""
} |
q2785 | Oxblood.RSocket.gets | train | def gets(separator, timeout = @timeout)
while (crlf = @buffer.index(separator)).nil?
@buffer << readpartial(1024, timeout)
| ruby | {
"resource": ""
} |
q2786 | Oxblood.RSocket.write | train | def write(data, timeout = @timeout)
full_size = data.bytesize
while data.bytesize > 0
written = socket.write_nonblock(data, exception: false)
if written == :wait_writable
| ruby | {
"resource": ""
} |
q2787 | Laundry.SOAPModel.instance_action_module | train | def instance_action_module
@instance_action_module ||= Module.new do
# Returns the <tt>Savon::Client</tt> from the class instance.
def client(&block)
self.class.client(&block)
end
private
def merged_default_body(body = {})
| ruby | {
"resource": ""
} |
q2788 | Vanguard.Result.violations | train | def violations
validator.rules.each_with_object(Set.new) do |rule, violations|
| ruby | {
"resource": ""
} |
q2789 | RFuse.Fuse.run | train | def run(signals=Signal.list.keys)
if mounted?
begin
traps = trap_signals(*signals)
self.loop()
| ruby | {
"resource": ""
} |
q2790 | RFuse.Fuse.loop | train | def loop()
raise RFuse::Error, "Already running!" if @running
raise RFuse::Error, "FUSE not mounted" unless mounted?
@running = true
while @running do
begin
ready, ignore, errors = IO.select([@fuse_io,@pr],[],[@fuse_io])
... | ruby | {
"resource": ""
} |
q2791 | RFuse.FuseDelegator.debug= | train | def debug=(value)
value = value ? true : false
if @debug && !value
$stderr.puts "=== #{ self }.debug=false"
elsif !@debug && value
| ruby | {
"resource": ""
} |
q2792 | Watir.Element.dom_changed? | train | def dom_changed?(delay: 1.1)
element_call do
begin
driver.manage.timeouts.script_timeout = delay + 1
driver.execute_async_script(DOM_WAIT_JS, wd, delay)
rescue Selenium::WebDriver::Error::JavascriptError => error
# sometimes we start script execution before new page i... | ruby | {
"resource": ""
} |
q2793 | ESP.Signature.run! | train | def run!(arguments = {})
result = run(arguments)
return result if result.is_a?(ActiveResource::Collection)
| ruby | {
"resource": ""
} |
q2794 | ESP.Signature.run | train | def run(arguments = {})
arguments = arguments.with_indifferent_access
attributes['external_account_id'] ||= arguments[:external_account_id]
attributes['region'] ||= arguments[:region]
response = connection.post("#{self.class.prefix}signatures/#{id}/run.json", to_json)
ESP::Alert.send(:ins... | ruby | {
"resource": ""
} |
q2795 | ESP.Signature.suppress | train | def suppress(arguments = {})
arguments = arguments.with_indifferent_access
ESP::Suppression::Signature.create(signature_ids: | ruby | {
"resource": ""
} |
q2796 | TableSetter.Table.csv_data | train | def csv_data
case
when google_key || url then Curl::Easy.perform(uri).body_str | ruby | {
"resource": ""
} |
q2797 | TableSetter.Table.updated_at | train | def updated_at
csv_time = google_key.nil? ? modification_time(uri) | ruby | {
"resource": ""
} |
q2798 | TableSetter.Table.paginate! | train | def paginate!(curr_page)
return if !hard_paginate?
@page = curr_page.to_i
raise ArgumentError if @page < 1 || @page > total_pages
adj_page = @page - 1 > 0 ? @page - 1 : 0
@prev_page = adj_page > 0 ? adj_page : nil
| ruby | {
"resource": ""
} |
q2799 | TableSetter.Table.sort_array | train | def sort_array
if @data.sorted_by
@data.sorted_by.inject([]) do |memo, (key, value)|
| ruby | {
"resource": ""
} |
Subsets and Splits
SQL Console for CoIR-Retrieval/CodeSearchNet-ccr-ruby-queries-corpus
Retrieves a large number of entries in the 'ruby' language, providing basic information but limited analytical value.