id int32 0 24.9k | repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,500 | BinaryStorms/civic-sip-ruby-sdk | lib/civic_sip_sdk/client.rb | CivicSIPSdk.Client.exchange_code | def exchange_code(jwt_token:)
json_body_str = JSON.generate('authToken' => jwt_token)
response = HTTParty.post(
"#{BASE_URL}/#{@config.env}/#{AUTH_CODE_PATH}",
headers: {
'Content-Type' => MIMETYPE_JSON,
'Accept' => MIMETYPE_JSON,
'Content-Length' => json_body_... | ruby | def exchange_code(jwt_token:)
json_body_str = JSON.generate('authToken' => jwt_token)
response = HTTParty.post(
"#{BASE_URL}/#{@config.env}/#{AUTH_CODE_PATH}",
headers: {
'Content-Type' => MIMETYPE_JSON,
'Accept' => MIMETYPE_JSON,
'Content-Length' => json_body_... | [
"def",
"exchange_code",
"(",
"jwt_token",
":",
")",
"json_body_str",
"=",
"JSON",
".",
"generate",
"(",
"'authToken'",
"=>",
"jwt_token",
")",
"response",
"=",
"HTTParty",
".",
"post",
"(",
"\"#{BASE_URL}/#{@config.env}/#{AUTH_CODE_PATH}\"",
",",
"headers",
":",
"... | Creates a client
@param config [CivicSIPSdk::AppConfig] app_config that sets all the parameters of the client
Exchange authorization code in the form of a JWT Token for the user data
requested in the scope request.
@param jwt_token [String] a JWT token that contains the authorization code
@return [CivicSIPSdk::U... | [
"Creates",
"a",
"client"
] | 330f01409500b30129691e9990da69e57bd6fbf4 | https://github.com/BinaryStorms/civic-sip-ruby-sdk/blob/330f01409500b30129691e9990da69e57bd6fbf4/lib/civic_sip_sdk/client.rb#L34-L56 |
5,501 | kontena/opto | lib/opto/option.rb | Opto.Option.skip? | def skip?
return false unless has_group?
return true if group.any_true?(skip_if)
return true unless group.all_true?(only_if)
false
end | ruby | def skip?
return false unless has_group?
return true if group.any_true?(skip_if)
return true unless group.all_true?(only_if)
false
end | [
"def",
"skip?",
"return",
"false",
"unless",
"has_group?",
"return",
"true",
"if",
"group",
".",
"any_true?",
"(",
"skip_if",
")",
"return",
"true",
"unless",
"group",
".",
"all_true?",
"(",
"only_if",
")",
"false",
"end"
] | Returns true if this field should not be processed because of the conditionals
@return [Boolean] | [
"Returns",
"true",
"if",
"this",
"field",
"should",
"not",
"be",
"processed",
"because",
"of",
"the",
"conditionals"
] | 7be243226fd2dc6beca61f49379894115396a424 | https://github.com/kontena/opto/blob/7be243226fd2dc6beca61f49379894115396a424/lib/opto/option.rb#L163-L168 |
5,502 | kontena/opto | lib/opto/option.rb | Opto.Option.resolvers | def resolvers
@resolvers ||= from.merge(default: self).map { |origin, hint| { origin: origin, hint: hint, resolver: ((has_group? && group.resolvers[origin]) || Resolver.for(origin)) } }
end | ruby | def resolvers
@resolvers ||= from.merge(default: self).map { |origin, hint| { origin: origin, hint: hint, resolver: ((has_group? && group.resolvers[origin]) || Resolver.for(origin)) } }
end | [
"def",
"resolvers",
"@resolvers",
"||=",
"from",
".",
"merge",
"(",
"default",
":",
"self",
")",
".",
"map",
"{",
"|",
"origin",
",",
"hint",
"|",
"{",
"origin",
":",
"origin",
",",
"hint",
":",
"hint",
",",
"resolver",
":",
"(",
"(",
"has_group?",
... | Accessor to defined resolvers for this option.
@return [Array<Opto::Resolver>] | [
"Accessor",
"to",
"defined",
"resolvers",
"for",
"this",
"option",
"."
] | 7be243226fd2dc6beca61f49379894115396a424 | https://github.com/kontena/opto/blob/7be243226fd2dc6beca61f49379894115396a424/lib/opto/option.rb#L205-L207 |
5,503 | hsribei/goalie | lib/goalie.rb | Goalie.CustomErrorPages.rescue_action_locally | def rescue_action_locally(request, exception)
# TODO this should probably move to the controller, that is, have
# http error codes map directly to controller actions, then let
# controller handle different exception classes however it wants
rescue_actions = Hash.new('diagnostics')
rescue_a... | ruby | def rescue_action_locally(request, exception)
# TODO this should probably move to the controller, that is, have
# http error codes map directly to controller actions, then let
# controller handle different exception classes however it wants
rescue_actions = Hash.new('diagnostics')
rescue_a... | [
"def",
"rescue_action_locally",
"(",
"request",
",",
"exception",
")",
"# TODO this should probably move to the controller, that is, have",
"# http error codes map directly to controller actions, then let",
"# controller handle different exception classes however it wants",
"rescue_actions",
"... | Render detailed diagnostics for unhandled exceptions rescued from
a controller action. | [
"Render",
"detailed",
"diagnostics",
"for",
"unhandled",
"exceptions",
"rescued",
"from",
"a",
"controller",
"action",
"."
] | 9095585ec1790f6bb423b763dc0bfa7b013139dc | https://github.com/hsribei/goalie/blob/9095585ec1790f6bb423b763dc0bfa7b013139dc/lib/goalie.rb#L79-L101 |
5,504 | opengovernment/govkit | lib/gov_kit/resource.rb | GovKit.Resource.find_resource_in_modules | def find_resource_in_modules(resource_name, ancestors)
if namespace = ancestors.detect { |a| a.constants.include?(resource_name.to_sym) }
return namespace.const_get(resource_name)
else
raise NameError, "Namespace for #{namespace} not found"
end
end | ruby | def find_resource_in_modules(resource_name, ancestors)
if namespace = ancestors.detect { |a| a.constants.include?(resource_name.to_sym) }
return namespace.const_get(resource_name)
else
raise NameError, "Namespace for #{namespace} not found"
end
end | [
"def",
"find_resource_in_modules",
"(",
"resource_name",
",",
"ancestors",
")",
"if",
"namespace",
"=",
"ancestors",
".",
"detect",
"{",
"|",
"a",
"|",
"a",
".",
"constants",
".",
"include?",
"(",
"resource_name",
".",
"to_sym",
")",
"}",
"return",
"namespac... | Searches each module in +ancestors+ for members named +resource_name+
Returns the named resource
Throws a NameError if none of the resources in the list contains +resource_name+ | [
"Searches",
"each",
"module",
"in",
"+",
"ancestors",
"+",
"for",
"members",
"named",
"+",
"resource_name",
"+",
"Returns",
"the",
"named",
"resource",
"Throws",
"a",
"NameError",
"if",
"none",
"of",
"the",
"resources",
"in",
"the",
"list",
"contains",
"+",
... | 6e1864ef173109dbb1cfadedb19e69849f8ed226 | https://github.com/opengovernment/govkit/blob/6e1864ef173109dbb1cfadedb19e69849f8ed226/lib/gov_kit/resource.rb#L146-L152 |
5,505 | opengovernment/govkit | lib/gov_kit/resource.rb | GovKit.Resource.find_or_create_resource_for | def find_or_create_resource_for(name)
resource_name = name.to_s.gsub(/^[_\-+]/,'').gsub(/^(\-?\d)/, "n#{$1}").gsub(/(\s|-)/, '').camelize
if self.class.parents.size > 1
find_resource_in_modules(resource_name, self.class.parents)
else
self.class.const_get(resource_name)
end
re... | ruby | def find_or_create_resource_for(name)
resource_name = name.to_s.gsub(/^[_\-+]/,'').gsub(/^(\-?\d)/, "n#{$1}").gsub(/(\s|-)/, '').camelize
if self.class.parents.size > 1
find_resource_in_modules(resource_name, self.class.parents)
else
self.class.const_get(resource_name)
end
re... | [
"def",
"find_or_create_resource_for",
"(",
"name",
")",
"resource_name",
"=",
"name",
".",
"to_s",
".",
"gsub",
"(",
"/",
"\\-",
"/",
",",
"''",
")",
".",
"gsub",
"(",
"/",
"\\-",
"\\d",
"/",
",",
"\"n#{$1}\"",
")",
".",
"gsub",
"(",
"/",
"\\s",
"/... | Searches the GovKit module for a resource with the name +name+, cleaned and camelized
Returns that resource.
If the resource isn't found, it's created. | [
"Searches",
"the",
"GovKit",
"module",
"for",
"a",
"resource",
"with",
"the",
"name",
"+",
"name",
"+",
"cleaned",
"and",
"camelized",
"Returns",
"that",
"resource",
".",
"If",
"the",
"resource",
"isn",
"t",
"found",
"it",
"s",
"created",
"."
] | 6e1864ef173109dbb1cfadedb19e69849f8ed226 | https://github.com/opengovernment/govkit/blob/6e1864ef173109dbb1cfadedb19e69849f8ed226/lib/gov_kit/resource.rb#L158-L172 |
5,506 | koraktor/rubikon | lib/rubikon/argument_vector.rb | Rubikon.ArgumentVector.command! | def command!(commands)
command = nil
command_index = 0
each_with_index do |arg, i|
break if arg == '--'
command = commands[arg.to_sym]
unless command.nil?
command_index = i
delete_at i
break
end
end
delete '--'
command |... | ruby | def command!(commands)
command = nil
command_index = 0
each_with_index do |arg, i|
break if arg == '--'
command = commands[arg.to_sym]
unless command.nil?
command_index = i
delete_at i
break
end
end
delete '--'
command |... | [
"def",
"command!",
"(",
"commands",
")",
"command",
"=",
"nil",
"command_index",
"=",
"0",
"each_with_index",
"do",
"|",
"arg",
",",
"i",
"|",
"break",
"if",
"arg",
"==",
"'--'",
"command",
"=",
"commands",
"[",
"arg",
".",
"to_sym",
"]",
"unless",
"co... | Gets the command to use from the list of arguments passed to the
application. The first argument matching a command name or alias will
cause the corresponding command to be selected.
The command and all arguments equal to '--' will be removed from the
array.
@param [Hash<Symbol, Command>] commands A list of avai... | [
"Gets",
"the",
"command",
"to",
"use",
"from",
"the",
"list",
"of",
"arguments",
"passed",
"to",
"the",
"application",
".",
"The",
"first",
"argument",
"matching",
"a",
"command",
"name",
"or",
"alias",
"will",
"cause",
"the",
"corresponding",
"command",
"to... | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/argument_vector.rb#L26-L44 |
5,507 | koraktor/rubikon | lib/rubikon/argument_vector.rb | Rubikon.ArgumentVector.expand! | def expand!
each_with_index do |arg, i|
next if !arg.start_with?('-')
self[i] = arg.split('=', 2)
next if arg.start_with?('--')
self[i] = arg[1..-1].split('').uniq.map { |a| '-' + a }
end
flatten!
end | ruby | def expand!
each_with_index do |arg, i|
next if !arg.start_with?('-')
self[i] = arg.split('=', 2)
next if arg.start_with?('--')
self[i] = arg[1..-1].split('').uniq.map { |a| '-' + a }
end
flatten!
end | [
"def",
"expand!",
"each_with_index",
"do",
"|",
"arg",
",",
"i",
"|",
"next",
"if",
"!",
"arg",
".",
"start_with?",
"(",
"'-'",
")",
"self",
"[",
"i",
"]",
"=",
"arg",
".",
"split",
"(",
"'='",
",",
"2",
")",
"next",
"if",
"arg",
".",
"start_with... | Turns arguments using a special syntax into arguments that are parseable.
Single character parameters may be joined together like '-dv'. This
method will split them into separate parameters like '-d -v'.
Additionally a parameter argument may be attached to the parameter itself
using '=' like '--path=/tmp'. This m... | [
"Turns",
"arguments",
"using",
"a",
"special",
"syntax",
"into",
"arguments",
"that",
"are",
"parseable",
"."
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/argument_vector.rb#L54-L62 |
5,508 | koraktor/rubikon | lib/rubikon/argument_vector.rb | Rubikon.ArgumentVector.params! | def params!(params, pos = 0)
active_params = []
to_delete = []
each_with_index do |arg, i|
next if i < pos || arg.nil? || !arg.start_with?('-')
param = params[(arg.start_with?('--') ? arg[2..-1] : arg[1..1]).to_sym]
unless param.nil?
to_delete << i
scop... | ruby | def params!(params, pos = 0)
active_params = []
to_delete = []
each_with_index do |arg, i|
next if i < pos || arg.nil? || !arg.start_with?('-')
param = params[(arg.start_with?('--') ? arg[2..-1] : arg[1..1]).to_sym]
unless param.nil?
to_delete << i
scop... | [
"def",
"params!",
"(",
"params",
",",
"pos",
"=",
"0",
")",
"active_params",
"=",
"[",
"]",
"to_delete",
"=",
"[",
"]",
"each_with_index",
"do",
"|",
"arg",
",",
"i",
"|",
"next",
"if",
"i",
"<",
"pos",
"||",
"arg",
".",
"nil?",
"||",
"!",
"arg",... | Selects active parameters from a list of available parameters
For every option found in the argument list {#scoped_args!} is called to
find the arguments for that option.
All parameters found will be removed from the array.
@param [Hash<Symbol, Parameter>] params A list of available parameters
@param [Fixnum] p... | [
"Selects",
"active",
"parameters",
"from",
"a",
"list",
"of",
"available",
"parameters"
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/argument_vector.rb#L76-L93 |
5,509 | koraktor/rubikon | lib/rubikon/argument_vector.rb | Rubikon.ArgumentVector.scoped_args! | def scoped_args!(has_args, pos = 0)
to_delete = []
each_with_index do |arg, i|
next if i < pos
break if arg.start_with?('-') || !has_args.send(:more_args?)
to_delete << i
has_args.send(:<<, arg)
end
to_delete.reverse.each { |i| delete_at i }
end | ruby | def scoped_args!(has_args, pos = 0)
to_delete = []
each_with_index do |arg, i|
next if i < pos
break if arg.start_with?('-') || !has_args.send(:more_args?)
to_delete << i
has_args.send(:<<, arg)
end
to_delete.reverse.each { |i| delete_at i }
end | [
"def",
"scoped_args!",
"(",
"has_args",
",",
"pos",
"=",
"0",
")",
"to_delete",
"=",
"[",
"]",
"each_with_index",
"do",
"|",
"arg",
",",
"i",
"|",
"next",
"if",
"i",
"<",
"pos",
"break",
"if",
"arg",
".",
"start_with?",
"(",
"'-'",
")",
"||",
"!",
... | Gets all arguments passed to a specific scope, i.e. a command or an
option.
All arguments in the scope will be removed from the array.
@param [HasArguments] has_args
@param [Fixnum] pos The position of the first argument that should be
checked. All arguments ahead of that position will be skipped. | [
"Gets",
"all",
"arguments",
"passed",
"to",
"a",
"specific",
"scope",
"i",
".",
"e",
".",
"a",
"command",
"or",
"an",
"option",
"."
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/argument_vector.rb#L103-L115 |
5,510 | chikamichi/amb | lib/amb/amb.rb | Amb.ClassMethods.solve | def solve(failure_message = "No solution.")
amb = self.new
yield(amb)
rescue Amb::ExhaustedError => ex
puts
puts "#{amb.branches_count} branches explored." if $DEBUG
amb.report(failure_message)
end | ruby | def solve(failure_message = "No solution.")
amb = self.new
yield(amb)
rescue Amb::ExhaustedError => ex
puts
puts "#{amb.branches_count} branches explored." if $DEBUG
amb.report(failure_message)
end | [
"def",
"solve",
"(",
"failure_message",
"=",
"\"No solution.\"",
")",
"amb",
"=",
"self",
".",
"new",
"yield",
"(",
"amb",
")",
"rescue",
"Amb",
"::",
"ExhaustedError",
"=>",
"ex",
"puts",
"puts",
"\"#{amb.branches_count} branches explored.\"",
"if",
"$DEBUG",
"... | Class convenience method to search for the first solution to the
constraints. | [
"Class",
"convenience",
"method",
"to",
"search",
"for",
"the",
"first",
"solution",
"to",
"the",
"constraints",
"."
] | 427f7056ee54406603b30f309e815af637800133 | https://github.com/chikamichi/amb/blob/427f7056ee54406603b30f309e815af637800133/lib/amb/amb.rb#L152-L159 |
5,511 | chikamichi/amb | lib/amb/amb.rb | Amb.ClassMethods.solve_all | def solve_all(failure_message = "No more solutions.")
amb = self.new
yield(amb)
amb.failure
rescue Amb::ExhaustedError => ex
puts
puts "#{amb.branches_count} branches explored." if $DEBUG
amb.report(failure_message)
end | ruby | def solve_all(failure_message = "No more solutions.")
amb = self.new
yield(amb)
amb.failure
rescue Amb::ExhaustedError => ex
puts
puts "#{amb.branches_count} branches explored." if $DEBUG
amb.report(failure_message)
end | [
"def",
"solve_all",
"(",
"failure_message",
"=",
"\"No more solutions.\"",
")",
"amb",
"=",
"self",
".",
"new",
"yield",
"(",
"amb",
")",
"amb",
".",
"failure",
"rescue",
"Amb",
"::",
"ExhaustedError",
"=>",
"ex",
"puts",
"puts",
"\"#{amb.branches_count} branche... | Class convenience method to search for all the solutions to the
constraints. | [
"Class",
"convenience",
"method",
"to",
"search",
"for",
"all",
"the",
"solutions",
"to",
"the",
"constraints",
"."
] | 427f7056ee54406603b30f309e815af637800133 | https://github.com/chikamichi/amb/blob/427f7056ee54406603b30f309e815af637800133/lib/amb/amb.rb#L164-L172 |
5,512 | scepticulous/crypto-toolbox | lib/crypto-toolbox/analyzers/ecb_string_appender.rb | Analyzers.EcbStringAppender.calculate_block_size | def calculate_block_size
char_amount = 1
base_length = @oracle.encipher(DUMMY * char_amount).length
result = nil
(1..MAX_KNOWN_BLOCK_LENGTH).each do |length|
new_length = @oracle.encipher(DUMMY * char_amount).length
if new_length > base_length
result = new_length - ba... | ruby | def calculate_block_size
char_amount = 1
base_length = @oracle.encipher(DUMMY * char_amount).length
result = nil
(1..MAX_KNOWN_BLOCK_LENGTH).each do |length|
new_length = @oracle.encipher(DUMMY * char_amount).length
if new_length > base_length
result = new_length - ba... | [
"def",
"calculate_block_size",
"char_amount",
"=",
"1",
"base_length",
"=",
"@oracle",
".",
"encipher",
"(",
"DUMMY",
"*",
"char_amount",
")",
".",
"length",
"result",
"=",
"nil",
"(",
"1",
"..",
"MAX_KNOWN_BLOCK_LENGTH",
")",
".",
"each",
"do",
"|",
"length... | calculate the block size by detecting the growth
of the resulting ciphertext by sending messages
which length increases by one until a change occurs | [
"calculate",
"the",
"block",
"size",
"by",
"detecting",
"the",
"growth",
"of",
"the",
"resulting",
"ciphertext",
"by",
"sending",
"messages",
"which",
"length",
"increases",
"by",
"one",
"until",
"a",
"change",
"occurs"
] | cdbe371109e497db2c2af5c1fe0f359612f44816 | https://github.com/scepticulous/crypto-toolbox/blob/cdbe371109e497db2c2af5c1fe0f359612f44816/lib/crypto-toolbox/analyzers/ecb_string_appender.rb#L118-L131 |
5,513 | ArchimediaZerogroup/KonoUtils | lib/kono_utils/encoder.rb | KonoUtils.Encoder.string_encoder | def string_encoder
return string if string.valid_encoding?
str = string
Encoding.list.each do |e|
begin
str.force_encoding(e.name)
tmp_string = str.encode('UTF-8')
return tmp_string if tmp_string.valid_encoding?
rescue
Rails.logger.debug { "Rescu... | ruby | def string_encoder
return string if string.valid_encoding?
str = string
Encoding.list.each do |e|
begin
str.force_encoding(e.name)
tmp_string = str.encode('UTF-8')
return tmp_string if tmp_string.valid_encoding?
rescue
Rails.logger.debug { "Rescu... | [
"def",
"string_encoder",
"return",
"string",
"if",
"string",
".",
"valid_encoding?",
"str",
"=",
"string",
"Encoding",
".",
"list",
".",
"each",
"do",
"|",
"e",
"|",
"begin",
"str",
".",
"force_encoding",
"(",
"e",
".",
"name",
")",
"tmp_string",
"=",
"s... | Funzione di encoding semplice | [
"Funzione",
"di",
"encoding",
"semplice"
] | a255a30b65e4e0f01cd6236d991da4fd13c64fc6 | https://github.com/ArchimediaZerogroup/KonoUtils/blob/a255a30b65e4e0f01cd6236d991da4fd13c64fc6/lib/kono_utils/encoder.rb#L24-L40 |
5,514 | cbot/push0r | lib/push0r/APNS/ApnsService.rb | Push0r.ApnsService.get_feedback | def get_feedback
tokens = []
begin
setup_ssl(true)
rescue SocketError => e
puts "Error: #{e}"
return tokens
end
if IO.select([@ssl], nil, nil, 1)
while (line = @ssl.read(38))
f = line.unpack('N1n1H64')
time = Time.at(f[0])
tok... | ruby | def get_feedback
tokens = []
begin
setup_ssl(true)
rescue SocketError => e
puts "Error: #{e}"
return tokens
end
if IO.select([@ssl], nil, nil, 1)
while (line = @ssl.read(38))
f = line.unpack('N1n1H64')
time = Time.at(f[0])
tok... | [
"def",
"get_feedback",
"tokens",
"=",
"[",
"]",
"begin",
"setup_ssl",
"(",
"true",
")",
"rescue",
"SocketError",
"=>",
"e",
"puts",
"\"Error: #{e}\"",
"return",
"tokens",
"end",
"if",
"IO",
".",
"select",
"(",
"[",
"@ssl",
"]",
",",
"nil",
",",
"nil",
... | Calls the APNS feedback service and returns an array of expired push tokens
@return [Array<String>] an array of expired push tokens | [
"Calls",
"the",
"APNS",
"feedback",
"service",
"and",
"returns",
"an",
"array",
"of",
"expired",
"push",
"tokens"
] | 07eb7bece1f251608529dea0d7a93af1444ffeb6 | https://github.com/cbot/push0r/blob/07eb7bece1f251608529dea0d7a93af1444ffeb6/lib/push0r/APNS/ApnsService.rb#L83-L105 |
5,515 | ideonetwork/lato-core | app/cells/lato_core/elements/pagination/cell.rb | LatoCore.Elements::Pagination::Cell.generate_page_link | def generate_page_link page_number
url = core__add_param_to_url(@args[:url], @args[:param], page_number)
if @args[:extra_params]
@args[:extra_params].each do |key, value|
url = core__add_param_to_url(url, key, value)
end
end
url
end | ruby | def generate_page_link page_number
url = core__add_param_to_url(@args[:url], @args[:param], page_number)
if @args[:extra_params]
@args[:extra_params].each do |key, value|
url = core__add_param_to_url(url, key, value)
end
end
url
end | [
"def",
"generate_page_link",
"page_number",
"url",
"=",
"core__add_param_to_url",
"(",
"@args",
"[",
":url",
"]",
",",
"@args",
"[",
":param",
"]",
",",
"page_number",
")",
"if",
"@args",
"[",
":extra_params",
"]",
"@args",
"[",
":extra_params",
"]",
".",
"e... | This function generate the link to go to a specific page number | [
"This",
"function",
"generate",
"the",
"link",
"to",
"go",
"to",
"a",
"specific",
"page",
"number"
] | c01fa585725c8e9992f25d8a7bd4ba2d0bfca08c | https://github.com/ideonetwork/lato-core/blob/c01fa585725c8e9992f25d8a7bd4ba2d0bfca08c/app/cells/lato_core/elements/pagination/cell.rb#L56-L64 |
5,516 | JulianNicholls/gosu_enhanced-gem | lib/gosu_enhanced/size.rb | GosuEnhanced.Size.inflate! | def inflate!(by_w, by_h = nil)
return inflate_by_size(by_w) if by_w.respond_to? :width
validate(by_w, by_h)
@width += by_w
@height += by_h
self
end | ruby | def inflate!(by_w, by_h = nil)
return inflate_by_size(by_w) if by_w.respond_to? :width
validate(by_w, by_h)
@width += by_w
@height += by_h
self
end | [
"def",
"inflate!",
"(",
"by_w",
",",
"by_h",
"=",
"nil",
")",
"return",
"inflate_by_size",
"(",
"by_w",
")",
"if",
"by_w",
".",
"respond_to?",
":width",
"validate",
"(",
"by_w",
",",
"by_h",
")",
"@width",
"+=",
"by_w",
"@height",
"+=",
"by_h",
"self",
... | INcrease the dimensions of the current Size in the width direction
by +by_w+ and in the height direction by +by_h+.
by_w and by_h can be a Fixnum, or another Size. | [
"INcrease",
"the",
"dimensions",
"of",
"the",
"current",
"Size",
"in",
"the",
"width",
"direction",
"by",
"+",
"by_w",
"+",
"and",
"in",
"the",
"height",
"direction",
"by",
"+",
"by_h",
"+",
"."
] | 07b5258458c4c3c315f697c8d5da839a93eb2c67 | https://github.com/JulianNicholls/gosu_enhanced-gem/blob/07b5258458c4c3c315f697c8d5da839a93eb2c67/lib/gosu_enhanced/size.rb#L46-L55 |
5,517 | JulianNicholls/gosu_enhanced-gem | lib/gosu_enhanced/size.rb | GosuEnhanced.Size.deflate! | def deflate!(by_w, by_h = nil)
if by_w.respond_to? :width
inflate!(-by_w.width, -by_w.height)
else
inflate!(-by_w, -by_h)
end
end | ruby | def deflate!(by_w, by_h = nil)
if by_w.respond_to? :width
inflate!(-by_w.width, -by_w.height)
else
inflate!(-by_w, -by_h)
end
end | [
"def",
"deflate!",
"(",
"by_w",
",",
"by_h",
"=",
"nil",
")",
"if",
"by_w",
".",
"respond_to?",
":width",
"inflate!",
"(",
"-",
"by_w",
".",
"width",
",",
"-",
"by_w",
".",
"height",
")",
"else",
"inflate!",
"(",
"-",
"by_w",
",",
"-",
"by_h",
")",... | DEcrease the dimensions of the current Size in the width direction
by +by_w+ and in the height direction by +by_h+.
by_w and by_h can be a Fixnum, or another Size. | [
"DEcrease",
"the",
"dimensions",
"of",
"the",
"current",
"Size",
"in",
"the",
"width",
"direction",
"by",
"+",
"by_w",
"+",
"and",
"in",
"the",
"height",
"direction",
"by",
"+",
"by_h",
"+",
"."
] | 07b5258458c4c3c315f697c8d5da839a93eb2c67 | https://github.com/JulianNicholls/gosu_enhanced-gem/blob/07b5258458c4c3c315f697c8d5da839a93eb2c67/lib/gosu_enhanced/size.rb#L62-L68 |
5,518 | JulianNicholls/gosu_enhanced-gem | lib/gosu_enhanced/size.rb | GosuEnhanced.Size.inflate_by_size | def inflate_by_size(sz)
width = sz.width
height = sz.height
validate(width, height)
@width += width
@height += height
self
end | ruby | def inflate_by_size(sz)
width = sz.width
height = sz.height
validate(width, height)
@width += width
@height += height
self
end | [
"def",
"inflate_by_size",
"(",
"sz",
")",
"width",
"=",
"sz",
".",
"width",
"height",
"=",
"sz",
".",
"height",
"validate",
"(",
"width",
",",
"height",
")",
"@width",
"+=",
"width",
"@height",
"+=",
"height",
"self",
"end"
] | Change the dimensions using the dimensions of another Size. | [
"Change",
"the",
"dimensions",
"using",
"the",
"dimensions",
"of",
"another",
"Size",
"."
] | 07b5258458c4c3c315f697c8d5da839a93eb2c67 | https://github.com/JulianNicholls/gosu_enhanced-gem/blob/07b5258458c4c3c315f697c8d5da839a93eb2c67/lib/gosu_enhanced/size.rb#L93-L102 |
5,519 | ideonetwork/lato-core | lib/lato_core/interfaces/application.rb | LatoCore.Interface::Application.core__get_application_gems | def core__get_application_gems
gems = {}
Bundler.load.specs.each do |spec|
gems[spec.name] = spec.version
end
gems
end | ruby | def core__get_application_gems
gems = {}
Bundler.load.specs.each do |spec|
gems[spec.name] = spec.version
end
gems
end | [
"def",
"core__get_application_gems",
"gems",
"=",
"{",
"}",
"Bundler",
".",
"load",
".",
"specs",
".",
"each",
"do",
"|",
"spec",
"|",
"gems",
"[",
"spec",
".",
"name",
"]",
"=",
"spec",
".",
"version",
"end",
"gems",
"end"
] | This function return the list of gems used by the application. | [
"This",
"function",
"return",
"the",
"list",
"of",
"gems",
"used",
"by",
"the",
"application",
"."
] | c01fa585725c8e9992f25d8a7bd4ba2d0bfca08c | https://github.com/ideonetwork/lato-core/blob/c01fa585725c8e9992f25d8a7bd4ba2d0bfca08c/lib/lato_core/interfaces/application.rb#L13-L19 |
5,520 | ideonetwork/lato-core | lib/lato_core/interfaces/application.rb | LatoCore.Interface::Application.core__get_application_logo_sidebar_path | def core__get_application_logo_sidebar_path
dir = "#{core__get_application_root_path}/app/assets/images/lato/"
if File.exist?("#{dir}/logo_sidebar.svg")
return 'lato/logo_sidebar.svg'
elsif File.exist?("#{dir}/logo_sidebar.png")
return 'lato/logo_sidebar.png'
elsif File.exist?("#... | ruby | def core__get_application_logo_sidebar_path
dir = "#{core__get_application_root_path}/app/assets/images/lato/"
if File.exist?("#{dir}/logo_sidebar.svg")
return 'lato/logo_sidebar.svg'
elsif File.exist?("#{dir}/logo_sidebar.png")
return 'lato/logo_sidebar.png'
elsif File.exist?("#... | [
"def",
"core__get_application_logo_sidebar_path",
"dir",
"=",
"\"#{core__get_application_root_path}/app/assets/images/lato/\"",
"if",
"File",
".",
"exist?",
"(",
"\"#{dir}/logo_sidebar.svg\"",
")",
"return",
"'lato/logo_sidebar.svg'",
"elsif",
"File",
".",
"exist?",
"(",
"\"#{d... | This function return the path of the application logo for the sidebar. | [
"This",
"function",
"return",
"the",
"path",
"of",
"the",
"application",
"logo",
"for",
"the",
"sidebar",
"."
] | c01fa585725c8e9992f25d8a7bd4ba2d0bfca08c | https://github.com/ideonetwork/lato-core/blob/c01fa585725c8e9992f25d8a7bd4ba2d0bfca08c/lib/lato_core/interfaces/application.rb#L27-L39 |
5,521 | koraktor/rubikon | lib/rubikon/command.rb | Rubikon.Command.help | def help(show_usage = true)
help = ''
if show_usage
help << " #{name}" if name != :__default
@params.values.uniq.sort_by {|a| a.name.to_s }.each do |param|
help << ' ['
([param.name] + param.aliases).each_with_index do |name, index|
name = name.to_s
... | ruby | def help(show_usage = true)
help = ''
if show_usage
help << " #{name}" if name != :__default
@params.values.uniq.sort_by {|a| a.name.to_s }.each do |param|
help << ' ['
([param.name] + param.aliases).each_with_index do |name, index|
name = name.to_s
... | [
"def",
"help",
"(",
"show_usage",
"=",
"true",
")",
"help",
"=",
"''",
"if",
"show_usage",
"help",
"<<",
"\" #{name}\"",
"if",
"name",
"!=",
":__default",
"@params",
".",
"values",
".",
"uniq",
".",
"sort_by",
"{",
"|",
"a",
"|",
"a",
".",
"name",
".... | Create a new application command with the given name with a reference to
the app it belongs to
@param [Application::Base] app The application this command belongs to
@param [Symbol, #to_sym] name The name of this command, used in application
arguments
@param options (see HasArguments#initialize)
@param [P... | [
"Create",
"a",
"new",
"application",
"command",
"with",
"the",
"given",
"name",
"with",
"a",
"reference",
"to",
"the",
"app",
"it",
"belongs",
"to"
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/command.rb#L64-L119 |
5,522 | koraktor/rubikon | lib/rubikon/command.rb | Rubikon.Command.add_param | def add_param(parameter)
if parameter.is_a? Hash
parameter.each do |alias_name, name|
alias_name = alias_name.to_sym
name = name.to_sym
parameter = @params[name]
if parameter.nil?
@params[alias_name] = name
else
parameter.aliases <<... | ruby | def add_param(parameter)
if parameter.is_a? Hash
parameter.each do |alias_name, name|
alias_name = alias_name.to_sym
name = name.to_sym
parameter = @params[name]
if parameter.nil?
@params[alias_name] = name
else
parameter.aliases <<... | [
"def",
"add_param",
"(",
"parameter",
")",
"if",
"parameter",
".",
"is_a?",
"Hash",
"parameter",
".",
"each",
"do",
"|",
"alias_name",
",",
"name",
"|",
"alias_name",
"=",
"alias_name",
".",
"to_sym",
"name",
"=",
"name",
".",
"to_sym",
"parameter",
"=",
... | Add a new parameter for this command
@param [Parameter, Hash] parameter The parameter to add to this
command. This might also be a Hash where every key will be an
alias to the corresponding value, e.g. <tt>{ :alias => :parameter
}</tt>.
@see Parameter | [
"Add",
"a",
"new",
"parameter",
"for",
"this",
"command"
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/command.rb#L140-L163 |
5,523 | koraktor/rubikon | lib/rubikon/command.rb | Rubikon.Command.method_missing | def method_missing(name, *args, &block)
if args.empty? && !block_given?
if @params.key?(name)
return @params[name]
else
active_params.each do |param|
return param.send(name) if param.respond_to_missing?(name)
end
end
end
super
end | ruby | def method_missing(name, *args, &block)
if args.empty? && !block_given?
if @params.key?(name)
return @params[name]
else
active_params.each do |param|
return param.send(name) if param.respond_to_missing?(name)
end
end
end
super
end | [
"def",
"method_missing",
"(",
"name",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"args",
".",
"empty?",
"&&",
"!",
"block_given?",
"if",
"@params",
".",
"key?",
"(",
"name",
")",
"return",
"@params",
"[",
"name",
"]",
"else",
"active_params",
".",... | If a parameter with the specified method name exists, a call to that
method will return the value of the parameter.
@param (see ClassMethods#method_missing)
@example
option :user, [:who]
command :hello, [:mood] do
puts "Hello #{user.who}"
puts "I feel #{mood}"
end | [
"If",
"a",
"parameter",
"with",
"the",
"specified",
"method",
"name",
"exists",
"a",
"call",
"to",
"that",
"method",
"will",
"return",
"the",
"value",
"of",
"the",
"parameter",
"."
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/command.rb#L176-L188 |
5,524 | koraktor/rubikon | lib/rubikon/command.rb | Rubikon.Command.reset | def reset
super
@params.values.uniq.each do |param|
param.send(:reset) if param.is_a? Parameter
end
end | ruby | def reset
super
@params.values.uniq.each do |param|
param.send(:reset) if param.is_a? Parameter
end
end | [
"def",
"reset",
"super",
"@params",
".",
"values",
".",
"uniq",
".",
"each",
"do",
"|",
"param",
"|",
"param",
".",
"send",
"(",
":reset",
")",
"if",
"param",
".",
"is_a?",
"Parameter",
"end",
"end"
] | Resets this command to its initial state
@see HasArguments#reset
@since 0.4.0 | [
"Resets",
"this",
"command",
"to",
"its",
"initial",
"state"
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/command.rb#L194-L199 |
5,525 | koraktor/rubikon | lib/rubikon/command.rb | Rubikon.Command.respond_to_missing? | def respond_to_missing?(name, include_private = false)
@params.key?(name) ||
active_params.any? { |param| param.respond_to_missing?(name) } ||
super
end | ruby | def respond_to_missing?(name, include_private = false)
@params.key?(name) ||
active_params.any? { |param| param.respond_to_missing?(name) } ||
super
end | [
"def",
"respond_to_missing?",
"(",
"name",
",",
"include_private",
"=",
"false",
")",
"@params",
".",
"key?",
"(",
"name",
")",
"||",
"active_params",
".",
"any?",
"{",
"|",
"param",
"|",
"param",
".",
"respond_to_missing?",
"(",
"name",
")",
"}",
"||",
... | Checks whether a parameter with the given name exists for this command
This is used to determine if a method call would successfully return the
value of a parameter.
@return +true+ if named parameter with the specified name exists
@see #method_missing | [
"Checks",
"whether",
"a",
"parameter",
"with",
"the",
"given",
"name",
"exists",
"for",
"this",
"command"
] | c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b | https://github.com/koraktor/rubikon/blob/c5a09d2a6a0878bb4ae5bcf71fcb111646ed0b2b/lib/rubikon/command.rb#L208-L212 |
5,526 | ksylvest/attached | lib/attached/attatcher.rb | Attached.Attatcher.validations | def validations
name = @name
@klass.send(:validates_each, name) do |record, attr, value|
record.send(name).errors.each do |error|
record.errors.add(name, error)
end
end
end | ruby | def validations
name = @name
@klass.send(:validates_each, name) do |record, attr, value|
record.send(name).errors.each do |error|
record.errors.add(name, error)
end
end
end | [
"def",
"validations",
"name",
"=",
"@name",
"@klass",
".",
"send",
"(",
":validates_each",
",",
"name",
")",
"do",
"|",
"record",
",",
"attr",
",",
"value",
"|",
"record",
".",
"send",
"(",
"name",
")",
".",
"errors",
".",
"each",
"do",
"|",
"error",... | Forward validations.
Usage:
attacher.validations | [
"Forward",
"validations",
"."
] | 6ef5681efd94807d334b12d8229b57ac472a6576 | https://github.com/ksylvest/attached/blob/6ef5681efd94807d334b12d8229b57ac472a6576/lib/attached/attatcher.rb#L131-L138 |
5,527 | wordjelly/Auth | config/initializers/omniauth.rb | OmniAuth.Strategy.on_any_path? | def on_any_path?(paths)
path_found = false
paths.each do |path|
path_found = on_path?(path) ? true : path_found
end
return path_found
end | ruby | def on_any_path?(paths)
path_found = false
paths.each do |path|
path_found = on_path?(path) ? true : path_found
end
return path_found
end | [
"def",
"on_any_path?",
"(",
"paths",
")",
"path_found",
"=",
"false",
"paths",
".",
"each",
"do",
"|",
"path",
"|",
"path_found",
"=",
"on_path?",
"(",
"path",
")",
"?",
"true",
":",
"path_found",
"end",
"return",
"path_found",
"end"
] | a modification of the on path method to check if we are on any of the defined request or callback paths.
tests each of the provided paths to see if we are on it. | [
"a",
"modification",
"of",
"the",
"on",
"path",
"method",
"to",
"check",
"if",
"we",
"are",
"on",
"any",
"of",
"the",
"defined",
"request",
"or",
"callback",
"paths",
".",
"tests",
"each",
"of",
"the",
"provided",
"paths",
"to",
"see",
"if",
"we",
"are... | e1b6697a13c845f57b3cc83bfb79059a09541f47 | https://github.com/wordjelly/Auth/blob/e1b6697a13c845f57b3cc83bfb79059a09541f47/config/initializers/omniauth.rb#L11-L17 |
5,528 | ksylvest/attached | lib/attached/attachment.rb | Attached.Attachment.save | def save
self.queue.each do |style, file|
path = self.path(style)
self.storage.save(file, path) if file and path
end
self.purge.each do |path|
self.storage.destroy(path)
end
@purge = []
@queue = {}
end | ruby | def save
self.queue.each do |style, file|
path = self.path(style)
self.storage.save(file, path) if file and path
end
self.purge.each do |path|
self.storage.destroy(path)
end
@purge = []
@queue = {}
end | [
"def",
"save",
"self",
".",
"queue",
".",
"each",
"do",
"|",
"style",
",",
"file",
"|",
"path",
"=",
"self",
".",
"path",
"(",
"style",
")",
"self",
".",
"storage",
".",
"save",
"(",
"file",
",",
"path",
")",
"if",
"file",
"and",
"path",
"end",
... | Save an attachment.
Usage:
@object.avatar.save | [
"Save",
"an",
"attachment",
"."
] | 6ef5681efd94807d334b12d8229b57ac472a6576 | https://github.com/ksylvest/attached/blob/6ef5681efd94807d334b12d8229b57ac472a6576/lib/attached/attachment.rb#L181-L191 |
5,529 | ksylvest/attached | lib/attached/attachment.rb | Attached.Attachment.destroy | def destroy
if attached?
self.storage.destroy(self.path)
self.styles.each do |style, options|
self.storage.destroy(self.path(style))
end
end
@purge = []
@queue = {}
end | ruby | def destroy
if attached?
self.storage.destroy(self.path)
self.styles.each do |style, options|
self.storage.destroy(self.path(style))
end
end
@purge = []
@queue = {}
end | [
"def",
"destroy",
"if",
"attached?",
"self",
".",
"storage",
".",
"destroy",
"(",
"self",
".",
"path",
")",
"self",
".",
"styles",
".",
"each",
"do",
"|",
"style",
",",
"options",
"|",
"self",
".",
"storage",
".",
"destroy",
"(",
"self",
".",
"path",... | Destroy an attachment.
Usage:
@object.avatar.destroy | [
"Destroy",
"an",
"attachment",
"."
] | 6ef5681efd94807d334b12d8229b57ac472a6576 | https://github.com/ksylvest/attached/blob/6ef5681efd94807d334b12d8229b57ac472a6576/lib/attached/attachment.rb#L199-L208 |
5,530 | ksylvest/attached | lib/attached/attachment.rb | Attached.Attachment.url | def url(style = self.default)
path = self.path(style)
host = self.host
host = self.aliases[path.hash % self.aliases.count] unless self.aliases.empty?
return "#{host}#{path}"
end | ruby | def url(style = self.default)
path = self.path(style)
host = self.host
host = self.aliases[path.hash % self.aliases.count] unless self.aliases.empty?
return "#{host}#{path}"
end | [
"def",
"url",
"(",
"style",
"=",
"self",
".",
"default",
")",
"path",
"=",
"self",
".",
"path",
"(",
"style",
")",
"host",
"=",
"self",
".",
"host",
"host",
"=",
"self",
".",
"aliases",
"[",
"path",
".",
"hash",
"%",
"self",
".",
"aliases",
".",
... | Acesss the URL for an attachment.
Usage:
@object.avatar.url
@object.avatar.url(:small)
@object.avatar.url(:large) | [
"Acesss",
"the",
"URL",
"for",
"an",
"attachment",
"."
] | 6ef5681efd94807d334b12d8229b57ac472a6576 | https://github.com/ksylvest/attached/blob/6ef5681efd94807d334b12d8229b57ac472a6576/lib/attached/attachment.rb#L218-L223 |
5,531 | ksylvest/attached | lib/attached/attachment.rb | Attached.Attachment.path | def path(style = self.default)
path = self.attached? ? @path.clone : @missing.clone
path.gsub!(/:name/, name.to_s)
path.gsub!(/:style/, style.to_s)
path.gsub!(/:extension/, extension(style).to_s)
path.gsub!(/:identifier/, identifier(style).to_s)
return path
end | ruby | def path(style = self.default)
path = self.attached? ? @path.clone : @missing.clone
path.gsub!(/:name/, name.to_s)
path.gsub!(/:style/, style.to_s)
path.gsub!(/:extension/, extension(style).to_s)
path.gsub!(/:identifier/, identifier(style).to_s)
return path
end | [
"def",
"path",
"(",
"style",
"=",
"self",
".",
"default",
")",
"path",
"=",
"self",
".",
"attached?",
"?",
"@path",
".",
"clone",
":",
"@missing",
".",
"clone",
"path",
".",
"gsub!",
"(",
"/",
"/",
",",
"name",
".",
"to_s",
")",
"path",
".",
"gsu... | Access the path for an attachment.
Usage:
@object.avatar.url
@object.avatar.url(:small)
@object.avatar.url(:large) | [
"Access",
"the",
"path",
"for",
"an",
"attachment",
"."
] | 6ef5681efd94807d334b12d8229b57ac472a6576 | https://github.com/ksylvest/attached/blob/6ef5681efd94807d334b12d8229b57ac472a6576/lib/attached/attachment.rb#L233-L240 |
5,532 | cyberarm/rewrite-gameoverseer | lib/gameoverseer/clients/client_manager.rb | GameOverseer.ClientManager.add | def add(client_id, ip_address)
@clients << {client_id: client_id, ip_address: ip_address}
GameOverseer::Services.client_connected(client_id, ip_address)
GameOverseer::Console.log("ClientManager> client with id '#{client_id}' connected")
end | ruby | def add(client_id, ip_address)
@clients << {client_id: client_id, ip_address: ip_address}
GameOverseer::Services.client_connected(client_id, ip_address)
GameOverseer::Console.log("ClientManager> client with id '#{client_id}' connected")
end | [
"def",
"add",
"(",
"client_id",
",",
"ip_address",
")",
"@clients",
"<<",
"{",
"client_id",
":",
"client_id",
",",
"ip_address",
":",
"ip_address",
"}",
"GameOverseer",
"::",
"Services",
".",
"client_connected",
"(",
"client_id",
",",
"ip_address",
")",
"GameO... | Add client to clients list
@param client_id [Integer]
@param ip_address [String] | [
"Add",
"client",
"to",
"clients",
"list"
] | 279ba63868ad11aa2c937fc6c2544049f05d4bca | https://github.com/cyberarm/rewrite-gameoverseer/blob/279ba63868ad11aa2c937fc6c2544049f05d4bca/lib/gameoverseer/clients/client_manager.rb#L15-L19 |
5,533 | cyberarm/rewrite-gameoverseer | lib/gameoverseer/clients/client_manager.rb | GameOverseer.ClientManager.remove | def remove(client_id)
@clients.each do |hash|
if hash[:client_id] == client_id
@clients.delete(hash)
GameOverseer::Services.client_disconnected(client_id)
GameOverseer::Console.log("ClientManager> client with id '#{client_id}' disconnected")
end
end
end | ruby | def remove(client_id)
@clients.each do |hash|
if hash[:client_id] == client_id
@clients.delete(hash)
GameOverseer::Services.client_disconnected(client_id)
GameOverseer::Console.log("ClientManager> client with id '#{client_id}' disconnected")
end
end
end | [
"def",
"remove",
"(",
"client_id",
")",
"@clients",
".",
"each",
"do",
"|",
"hash",
"|",
"if",
"hash",
"[",
":client_id",
"]",
"==",
"client_id",
"@clients",
".",
"delete",
"(",
"hash",
")",
"GameOverseer",
"::",
"Services",
".",
"client_disconnected",
"("... | Removes client data and disconnects client
@param client_id [Integer] ID of client | [
"Removes",
"client",
"data",
"and",
"disconnects",
"client"
] | 279ba63868ad11aa2c937fc6c2544049f05d4bca | https://github.com/cyberarm/rewrite-gameoverseer/blob/279ba63868ad11aa2c937fc6c2544049f05d4bca/lib/gameoverseer/clients/client_manager.rb#L48-L56 |
5,534 | eprothro/cassie | lib/cassie/schema/migration/dsl/table_operations.rb | Cassie::Schema::Migration::DSL.TableOperations.create_table | def create_table(table_name, options = {})
table_definition = TableDefinition.new
table_definition.define_primary_keys(options[:primary_keys]) if options[:primary_keys]
table_definition.define_partition_keys(options[:partition_keys]) if options[:partition_keys]
table_definition.define_options(op... | ruby | def create_table(table_name, options = {})
table_definition = TableDefinition.new
table_definition.define_primary_keys(options[:primary_keys]) if options[:primary_keys]
table_definition.define_partition_keys(options[:partition_keys]) if options[:partition_keys]
table_definition.define_options(op... | [
"def",
"create_table",
"(",
"table_name",
",",
"options",
"=",
"{",
"}",
")",
"table_definition",
"=",
"TableDefinition",
".",
"new",
"table_definition",
".",
"define_primary_keys",
"(",
"options",
"[",
":primary_keys",
"]",
")",
"if",
"options",
"[",
":primary_... | Creates a new table in the keyspace
options:
- :primary_keys: single value or array (for compound primary keys). If
not defined, some column must be chosen as primary key in the table definition. | [
"Creates",
"a",
"new",
"table",
"in",
"the",
"keyspace"
] | 63e71d12d3549882147e715e427a16fd8e0aa210 | https://github.com/eprothro/cassie/blob/63e71d12d3549882147e715e427a16fd8e0aa210/lib/cassie/schema/migration/dsl/table_operations.rb#L15-L33 |
5,535 | cyberarm/rewrite-gameoverseer | lib/gameoverseer/server/renet_server.rb | GameOverseer.ENetServer.transmit | def transmit(client_id, message, reliable = false, channel = ChannelManager::CHAT)
@server.send_packet(client_id, message, reliable, channel)
end | ruby | def transmit(client_id, message, reliable = false, channel = ChannelManager::CHAT)
@server.send_packet(client_id, message, reliable, channel)
end | [
"def",
"transmit",
"(",
"client_id",
",",
"message",
",",
"reliable",
"=",
"false",
",",
"channel",
"=",
"ChannelManager",
"::",
"CHAT",
")",
"@server",
".",
"send_packet",
"(",
"client_id",
",",
"message",
",",
"reliable",
",",
"channel",
")",
"end"
] | send message to a specific client
@param client_id [Integer] ID of client
@param message [String] message to be sent to client
@param reliable [Boolean] whether or not the packet is guaranteed to be received by the client
@param channel [Integer] what channel to send on | [
"send",
"message",
"to",
"a",
"specific",
"client"
] | 279ba63868ad11aa2c937fc6c2544049f05d4bca | https://github.com/cyberarm/rewrite-gameoverseer/blob/279ba63868ad11aa2c937fc6c2544049f05d4bca/lib/gameoverseer/server/renet_server.rb#L74-L76 |
5,536 | cyberarm/rewrite-gameoverseer | lib/gameoverseer/server/renet_server.rb | GameOverseer.ENetServer.broadcast | def broadcast(message, reliable = false, channel = ChannelManager::CHAT)
@server.broadcast_packet(message, reliable, channel)
end | ruby | def broadcast(message, reliable = false, channel = ChannelManager::CHAT)
@server.broadcast_packet(message, reliable, channel)
end | [
"def",
"broadcast",
"(",
"message",
",",
"reliable",
"=",
"false",
",",
"channel",
"=",
"ChannelManager",
"::",
"CHAT",
")",
"@server",
".",
"broadcast_packet",
"(",
"message",
",",
"reliable",
",",
"channel",
")",
"end"
] | send message to all connected clients
@param message [String] message to be sent to clients
@param reliable [Boolean] whether or not the packet is guaranteed to be received by the clients
@param channel [Integer] what channel to send on | [
"send",
"message",
"to",
"all",
"connected",
"clients"
] | 279ba63868ad11aa2c937fc6c2544049f05d4bca | https://github.com/cyberarm/rewrite-gameoverseer/blob/279ba63868ad11aa2c937fc6c2544049f05d4bca/lib/gameoverseer/server/renet_server.rb#L82-L84 |
5,537 | Falkor/falkorlib | lib/falkorlib/versioning.rb | FalkorLib.Versioning.bump | def bump(oldversion, level)
major = minor = patch = 0
if oldversion =~ /^(\d+)\.(\d+)\.(\d+)$/
major = Regexp.last_match(1).to_i
minor = Regexp.last_match(2).to_i
patch = Regexp.last_match(3).to_i
end
case level.to_sym
when :major
major += 1
minor = ... | ruby | def bump(oldversion, level)
major = minor = patch = 0
if oldversion =~ /^(\d+)\.(\d+)\.(\d+)$/
major = Regexp.last_match(1).to_i
minor = Regexp.last_match(2).to_i
patch = Regexp.last_match(3).to_i
end
case level.to_sym
when :major
major += 1
minor = ... | [
"def",
"bump",
"(",
"oldversion",
",",
"level",
")",
"major",
"=",
"minor",
"=",
"patch",
"=",
"0",
"if",
"oldversion",
"=~",
"/",
"\\d",
"\\.",
"\\d",
"\\.",
"\\d",
"/",
"major",
"=",
"Regexp",
".",
"last_match",
"(",
"1",
")",
".",
"to_i",
"minor... | Return a new version number based on
@param oldversion the old version (format: x.y.z)
@param level the level of bumping (either :major, :minor, :patch) | [
"Return",
"a",
"new",
"version",
"number",
"based",
"on"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/versioning.rb#L164-L184 |
5,538 | janfoeh/apidiesel | lib/apidiesel/dsl.rb | Apidiesel.Dsl.expects | def expects(&block)
builder = ExpectationBuilder.new
builder.instance_eval(&block)
parameter_validations.concat builder.parameter_validations
parameters_to_filter.concat builder.parameters_to_filter
end | ruby | def expects(&block)
builder = ExpectationBuilder.new
builder.instance_eval(&block)
parameter_validations.concat builder.parameter_validations
parameters_to_filter.concat builder.parameters_to_filter
end | [
"def",
"expects",
"(",
"&",
"block",
")",
"builder",
"=",
"ExpectationBuilder",
".",
"new",
"builder",
".",
"instance_eval",
"(",
"block",
")",
"parameter_validations",
".",
"concat",
"builder",
".",
"parameter_validations",
"parameters_to_filter",
".",
"concat",
... | Defines the input parameters expected for this API action.
@example
expects do
string :query
integer :per_page, :optional => true, :default => 10
end
See the {Apidiesel::Dsl::ExpectationBuilder ExpectationBuilder} instance methods
for more information on what to use within `expect`.
@macro [attac... | [
"Defines",
"the",
"input",
"parameters",
"expected",
"for",
"this",
"API",
"action",
"."
] | eb334f5744389ebaad19eb1343c4a27b2e3cf2e3 | https://github.com/janfoeh/apidiesel/blob/eb334f5744389ebaad19eb1343c4a27b2e3cf2e3/lib/apidiesel/dsl.rb#L16-L21 |
5,539 | janfoeh/apidiesel | lib/apidiesel/dsl.rb | Apidiesel.Dsl.responds_with | def responds_with(**args, &block)
builder = FilterBuilder.new
builder.instance_eval(&block)
response_filters.concat(builder.response_filters)
response_formatters.concat(builder.response_formatters)
if args[:unnested_hash]
response_formatters << lambda do |_, response|
... | ruby | def responds_with(**args, &block)
builder = FilterBuilder.new
builder.instance_eval(&block)
response_filters.concat(builder.response_filters)
response_formatters.concat(builder.response_formatters)
if args[:unnested_hash]
response_formatters << lambda do |_, response|
... | [
"def",
"responds_with",
"(",
"**",
"args",
",",
"&",
"block",
")",
"builder",
"=",
"FilterBuilder",
".",
"new",
"builder",
".",
"instance_eval",
"(",
"block",
")",
"response_filters",
".",
"concat",
"(",
"builder",
".",
"response_filters",
")",
"response_forma... | Defines the expected content and format of the response for this API action.
@example
responds_with do
string :user_id
end
See the {Apidiesel::Dsl::FilterBuilder FilterBuilder} instance methods
for more information on what to use within `responds_with`.
@macro [attach] responds_with
@yield [Apidies... | [
"Defines",
"the",
"expected",
"content",
"and",
"format",
"of",
"the",
"response",
"for",
"this",
"API",
"action",
"."
] | eb334f5744389ebaad19eb1343c4a27b2e3cf2e3 | https://github.com/janfoeh/apidiesel/blob/eb334f5744389ebaad19eb1343c4a27b2e3cf2e3/lib/apidiesel/dsl.rb#L35-L52 |
5,540 | Falkor/falkorlib | lib/falkorlib/common.rb | FalkorLib.Common.really_continue? | def really_continue?(default_answer = 'Yes')
return if FalkorLib.config[:no_interaction]
pattern = (default_answer =~ /yes/i) ? '(Y|n)' : '(y|N)'
answer = ask( cyan("=> Do you really want to continue #{pattern}?"), default_answer)
exit 0 if answer =~ /n.*/i
end | ruby | def really_continue?(default_answer = 'Yes')
return if FalkorLib.config[:no_interaction]
pattern = (default_answer =~ /yes/i) ? '(Y|n)' : '(y|N)'
answer = ask( cyan("=> Do you really want to continue #{pattern}?"), default_answer)
exit 0 if answer =~ /n.*/i
end | [
"def",
"really_continue?",
"(",
"default_answer",
"=",
"'Yes'",
")",
"return",
"if",
"FalkorLib",
".",
"config",
"[",
":no_interaction",
"]",
"pattern",
"=",
"(",
"default_answer",
"=~",
"/",
"/i",
")",
"?",
"'(Y|n)'",
":",
"'(y|N)'",
"answer",
"=",
"ask",
... | Ask whether or not to really continue | [
"Ask",
"whether",
"or",
"not",
"to",
"really",
"continue"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/common.rb#L99-L104 |
5,541 | Falkor/falkorlib | lib/falkorlib/common.rb | FalkorLib.Common.nice_execute | def nice_execute(cmd)
puts bold("[Running] #{cmd.gsub(/^\s*/, ' ')}")
stdout, stderr, exit_status = Open3.capture3( cmd )
unless stdout.empty?
stdout.each_line do |line|
print "** [out] #{line}"
$stdout.flush
end
end
unless stderr.empty?
stderr.e... | ruby | def nice_execute(cmd)
puts bold("[Running] #{cmd.gsub(/^\s*/, ' ')}")
stdout, stderr, exit_status = Open3.capture3( cmd )
unless stdout.empty?
stdout.each_line do |line|
print "** [out] #{line}"
$stdout.flush
end
end
unless stderr.empty?
stderr.e... | [
"def",
"nice_execute",
"(",
"cmd",
")",
"puts",
"bold",
"(",
"\"[Running] #{cmd.gsub(/^\\s*/, ' ')}\"",
")",
"stdout",
",",
"stderr",
",",
"exit_status",
"=",
"Open3",
".",
"capture3",
"(",
"cmd",
")",
"unless",
"stdout",
".",
"empty?",
"stdout",
".",
"each_li... | Execute a given command, return exit code and print nicely stdout and stderr | [
"Execute",
"a",
"given",
"command",
"return",
"exit",
"code",
"and",
"print",
"nicely",
"stdout",
"and",
"stderr"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/common.rb#L117-L133 |
5,542 | Falkor/falkorlib | lib/falkorlib/common.rb | FalkorLib.Common.execute_in_dir | def execute_in_dir(path, cmd)
exit_status = 0
Dir.chdir(path) do
exit_status = run %( #{cmd} )
end
exit_status
end | ruby | def execute_in_dir(path, cmd)
exit_status = 0
Dir.chdir(path) do
exit_status = run %( #{cmd} )
end
exit_status
end | [
"def",
"execute_in_dir",
"(",
"path",
",",
"cmd",
")",
"exit_status",
"=",
"0",
"Dir",
".",
"chdir",
"(",
"path",
")",
"do",
"exit_status",
"=",
"run",
"%( #{cmd} )",
"end",
"exit_status",
"end"
] | Execute in a given directory | [
"Execute",
"in",
"a",
"given",
"directory"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/common.rb#L143-L149 |
5,543 | Falkor/falkorlib | lib/falkorlib/common.rb | FalkorLib.Common.exec_or_exit | def exec_or_exit(cmd)
status = execute(cmd)
if (status.to_i.nonzero?)
error("The command '#{cmd}' failed with exit status #{status.to_i}")
end
status
end | ruby | def exec_or_exit(cmd)
status = execute(cmd)
if (status.to_i.nonzero?)
error("The command '#{cmd}' failed with exit status #{status.to_i}")
end
status
end | [
"def",
"exec_or_exit",
"(",
"cmd",
")",
"status",
"=",
"execute",
"(",
"cmd",
")",
"if",
"(",
"status",
".",
"to_i",
".",
"nonzero?",
")",
"error",
"(",
"\"The command '#{cmd}' failed with exit status #{status.to_i}\"",
")",
"end",
"status",
"end"
] | execute_in_dir
Execute a given command - exit if status != 0 | [
"execute_in_dir",
"Execute",
"a",
"given",
"command",
"-",
"exit",
"if",
"status",
"!",
"=",
"0"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/common.rb#L152-L158 |
5,544 | Falkor/falkorlib | lib/falkorlib/common.rb | FalkorLib.Common.select_from | def select_from(list, text = 'Select the index', default_idx = 0, raw_list = list)
error "list and raw_list differs in size" if list.size != raw_list.size
l = list
raw_l = raw_list
if list.is_a?(Array)
l = raw_l = { 0 => 'Exit' }
list.each_with_index do |e, idx|
l[i... | ruby | def select_from(list, text = 'Select the index', default_idx = 0, raw_list = list)
error "list and raw_list differs in size" if list.size != raw_list.size
l = list
raw_l = raw_list
if list.is_a?(Array)
l = raw_l = { 0 => 'Exit' }
list.each_with_index do |e, idx|
l[i... | [
"def",
"select_from",
"(",
"list",
",",
"text",
"=",
"'Select the index'",
",",
"default_idx",
"=",
"0",
",",
"raw_list",
"=",
"list",
")",
"error",
"\"list and raw_list differs in size\"",
"if",
"list",
".",
"size",
"!=",
"raw_list",
".",
"size",
"l",
"=",
... | Display a indexed list to select an i | [
"Display",
"a",
"indexed",
"list",
"to",
"select",
"an",
"i"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/common.rb#L227-L243 |
5,545 | Falkor/falkorlib | lib/falkorlib/common.rb | FalkorLib.Common.init_rvm | def init_rvm(rootdir = Dir.pwd, gemset = '')
rvm_files = {
:version => File.join(rootdir, '.ruby-version'),
:gemset => File.join(rootdir, '.ruby-gemset')
}
unless File.exist?( (rvm_files[:version]).to_s)
v = select_from(FalkorLib.config[:rvm][:rubies],
... | ruby | def init_rvm(rootdir = Dir.pwd, gemset = '')
rvm_files = {
:version => File.join(rootdir, '.ruby-version'),
:gemset => File.join(rootdir, '.ruby-gemset')
}
unless File.exist?( (rvm_files[:version]).to_s)
v = select_from(FalkorLib.config[:rvm][:rubies],
... | [
"def",
"init_rvm",
"(",
"rootdir",
"=",
"Dir",
".",
"pwd",
",",
"gemset",
"=",
"''",
")",
"rvm_files",
"=",
"{",
":version",
"=>",
"File",
".",
"join",
"(",
"rootdir",
",",
"'.ruby-version'",
")",
",",
":gemset",
"=>",
"File",
".",
"join",
"(",
"root... | copy_from_template
RVM init | [
"copy_from_template",
"RVM",
"init"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/common.rb#L452-L471 |
5,546 | Falkor/falkorlib | lib/falkorlib/bootstrap/base.rb | FalkorLib.Bootstrap.select_licence | def select_licence(default_licence = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
_options = {})
list_license = FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys
idx = list_license.index(default_licence) unless default_licence.nil?
select_from(list_license,
... | ruby | def select_licence(default_licence = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
_options = {})
list_license = FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys
idx = list_license.index(default_licence) unless default_licence.nil?
select_from(list_license,
... | [
"def",
"select_licence",
"(",
"default_licence",
"=",
"FalkorLib",
"::",
"Config",
"::",
"Bootstrap",
"::",
"DEFAULTS",
"[",
":metadata",
"]",
"[",
":license",
"]",
",",
"_options",
"=",
"{",
"}",
")",
"list_license",
"=",
"FalkorLib",
"::",
"Config",
"::",
... | select_forge
select_licence
Select a given licence for the project | [
"select_forge",
"select_licence",
"Select",
"a",
"given",
"licence",
"for",
"the",
"project"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/bootstrap/base.rb#L459-L467 |
5,547 | Falkor/falkorlib | lib/falkorlib/bootstrap/base.rb | FalkorLib.Bootstrap.license | def license(dir = Dir.pwd,
license = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
authors = '',
options = {
:filename => 'LICENSE'
})
return if ((license.empty?) or (license == 'none') or (license =~ /^CC/))
... | ruby | def license(dir = Dir.pwd,
license = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
authors = '',
options = {
:filename => 'LICENSE'
})
return if ((license.empty?) or (license == 'none') or (license =~ /^CC/))
... | [
"def",
"license",
"(",
"dir",
"=",
"Dir",
".",
"pwd",
",",
"license",
"=",
"FalkorLib",
"::",
"Config",
"::",
"Bootstrap",
"::",
"DEFAULTS",
"[",
":metadata",
"]",
"[",
":license",
"]",
",",
"authors",
"=",
"''",
",",
"options",
"=",
"{",
":filename",
... | select_licence
license
Generate the licence file
Supported options:
* :force [boolean] force action
* :filename [string] License file name
* :organization [string] Organization | [
"select_licence",
"license",
"Generate",
"the",
"licence",
"file"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/bootstrap/base.rb#L477-L493 |
5,548 | Falkor/falkorlib | lib/falkorlib/bootstrap/base.rb | FalkorLib.Bootstrap.guess_project_config | def guess_project_config(dir = Dir.pwd, options = {})
path = normalized_path(dir)
use_git = FalkorLib::Git.init?(path)
rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
local_config = FalkorLib::Config.get(rootdir, :local)
return local_config[:project] if local_config[:project]
... | ruby | def guess_project_config(dir = Dir.pwd, options = {})
path = normalized_path(dir)
use_git = FalkorLib::Git.init?(path)
rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
local_config = FalkorLib::Config.get(rootdir, :local)
return local_config[:project] if local_config[:project]
... | [
"def",
"guess_project_config",
"(",
"dir",
"=",
"Dir",
".",
"pwd",
",",
"options",
"=",
"{",
"}",
")",
"path",
"=",
"normalized_path",
"(",
"dir",
")",
"use_git",
"=",
"FalkorLib",
"::",
"Git",
".",
"init?",
"(",
"path",
")",
"rootdir",
"=",
"(",
"us... | license
guess_project_config
Guess the project configuration | [
"license",
"guess_project_config",
"Guess",
"the",
"project",
"configuration"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/bootstrap/base.rb#L499-L541 |
5,549 | ohler55/opee | lib/opee/collector.rb | Opee.Collector.collect | def collect(job, path_id=nil)
key = job_key(job)
token = @cache[key]
token = update_token(job, token, path_id)
if complete?(job, token)
@cache.delete(key)
keep_going(job)
else
@cache[key] = token
end
end | ruby | def collect(job, path_id=nil)
key = job_key(job)
token = @cache[key]
token = update_token(job, token, path_id)
if complete?(job, token)
@cache.delete(key)
keep_going(job)
else
@cache[key] = token
end
end | [
"def",
"collect",
"(",
"job",
",",
"path_id",
"=",
"nil",
")",
"key",
"=",
"job_key",
"(",
"job",
")",
"token",
"=",
"@cache",
"[",
"key",
"]",
"token",
"=",
"update_token",
"(",
"job",
",",
"token",
",",
"path_id",
")",
"if",
"complete?",
"(",
"jo... | Collects a job and deternines if the job should be moved on to the next
Actor or if it should wait until more processing paths have
finished. This method is executed asynchronously.
@param [Job|Object] job data to process or pass on
@param [Object] path_id identifier of the path the request came from | [
"Collects",
"a",
"job",
"and",
"deternines",
"if",
"the",
"job",
"should",
"be",
"moved",
"on",
"to",
"the",
"next",
"Actor",
"or",
"if",
"it",
"should",
"wait",
"until",
"more",
"processing",
"paths",
"have",
"finished",
".",
"This",
"method",
"is",
"ex... | 09d947affeddc0501f61b928050fbde1838ed57a | https://github.com/ohler55/opee/blob/09d947affeddc0501f61b928050fbde1838ed57a/lib/opee/collector.rb#L45-L55 |
5,550 | ohler55/opee | lib/opee/collector.rb | Opee.Collector.update_token | def update_token(job, token, path_id)
raise NotImplementedError.new("neither Collector.update_token() nor Job.update_token() are implemented") unless job.respond_to?(:update_token)
job.update_token(token, path_id)
end | ruby | def update_token(job, token, path_id)
raise NotImplementedError.new("neither Collector.update_token() nor Job.update_token() are implemented") unless job.respond_to?(:update_token)
job.update_token(token, path_id)
end | [
"def",
"update_token",
"(",
"job",
",",
"token",
",",
"path_id",
")",
"raise",
"NotImplementedError",
".",
"new",
"(",
"\"neither Collector.update_token() nor Job.update_token() are implemented\"",
")",
"unless",
"job",
".",
"respond_to?",
"(",
":update_token",
")",
"jo... | Updates the token associated with the job. The job or the Collector
subclass can use any data desired to keep track of the job's paths that
have been completed. This method is executed asynchronously.
@param [Object] job data to get the key for
@param [Object] token current token value or nil for the first token va... | [
"Updates",
"the",
"token",
"associated",
"with",
"the",
"job",
".",
"The",
"job",
"or",
"the",
"Collector",
"subclass",
"can",
"use",
"any",
"data",
"desired",
"to",
"keep",
"track",
"of",
"the",
"job",
"s",
"paths",
"that",
"have",
"been",
"completed",
... | 09d947affeddc0501f61b928050fbde1838ed57a | https://github.com/ohler55/opee/blob/09d947affeddc0501f61b928050fbde1838ed57a/lib/opee/collector.rb#L74-L77 |
5,551 | ohler55/opee | lib/opee/collector.rb | Opee.Collector.complete? | def complete?(job, token)
raise NotImplementedError.new("neither Collector.complete?() nor Job.complete?() are implemented") unless job.respond_to?(:complete?)
job.complete?(token)
end | ruby | def complete?(job, token)
raise NotImplementedError.new("neither Collector.complete?() nor Job.complete?() are implemented") unless job.respond_to?(:complete?)
job.complete?(token)
end | [
"def",
"complete?",
"(",
"job",
",",
"token",
")",
"raise",
"NotImplementedError",
".",
"new",
"(",
"\"neither Collector.complete?() nor Job.complete?() are implemented\"",
")",
"unless",
"job",
".",
"respond_to?",
"(",
":complete?",
")",
"job",
".",
"complete?",
"(",... | Returns true if the job has been processed by all paths converging on
the collector. This can be implemented in the Collector subclass or in
the Job. This method is executed asynchronously.
@param [Object] job data to get the key for
@param [Object] token current token value or nil for the first token value
@retur... | [
"Returns",
"true",
"if",
"the",
"job",
"has",
"been",
"processed",
"by",
"all",
"paths",
"converging",
"on",
"the",
"collector",
".",
"This",
"can",
"be",
"implemented",
"in",
"the",
"Collector",
"subclass",
"or",
"in",
"the",
"Job",
".",
"This",
"method",... | 09d947affeddc0501f61b928050fbde1838ed57a | https://github.com/ohler55/opee/blob/09d947affeddc0501f61b928050fbde1838ed57a/lib/opee/collector.rb#L85-L88 |
5,552 | ianbishop/yellow_api | lib/yellow_api/config.rb | YellowApi.Config.reset | def reset
self.apikey = DEFAULT_APIKEY
self.endpoint = DEFAULT_ENDPOINT
self.sandbox_endpoint = DEFAULT_SANDBOX_ENDPOINT
self.sandbox_enabled = DEFAULT_SANDBOX_ENABLED
self.fmt = DEFAULT_FMT
end | ruby | def reset
self.apikey = DEFAULT_APIKEY
self.endpoint = DEFAULT_ENDPOINT
self.sandbox_endpoint = DEFAULT_SANDBOX_ENDPOINT
self.sandbox_enabled = DEFAULT_SANDBOX_ENABLED
self.fmt = DEFAULT_FMT
end | [
"def",
"reset",
"self",
".",
"apikey",
"=",
"DEFAULT_APIKEY",
"self",
".",
"endpoint",
"=",
"DEFAULT_ENDPOINT",
"self",
".",
"sandbox_endpoint",
"=",
"DEFAULT_SANDBOX_ENDPOINT",
"self",
".",
"sandbox_enabled",
"=",
"DEFAULT_SANDBOX_ENABLED",
"self",
".",
"fmt",
"=",... | Reset all configurations back to defaults | [
"Reset",
"all",
"configurations",
"back",
"to",
"defaults"
] | 77e10948fe4eef6b6416c6fc9a597a19a41c3ff5 | https://github.com/ianbishop/yellow_api/blob/77e10948fe4eef6b6416c6fc9a597a19a41c3ff5/lib/yellow_api/config.rb#L63-L69 |
5,553 | polleverywhere/shart | lib/shart.rb | Shart.Sync.upload | def upload(&block)
@source.files.each do |key, file|
object = @target.files.create({
:key => key,
:body => file,
:public => true,
:cache_control => 'max-age=0' # Disable cache on S3 so that future sharts are visible if folks web browsers.
})
block.ca... | ruby | def upload(&block)
@source.files.each do |key, file|
object = @target.files.create({
:key => key,
:body => file,
:public => true,
:cache_control => 'max-age=0' # Disable cache on S3 so that future sharts are visible if folks web browsers.
})
block.ca... | [
"def",
"upload",
"(",
"&",
"block",
")",
"@source",
".",
"files",
".",
"each",
"do",
"|",
"key",
",",
"file",
"|",
"object",
"=",
"@target",
".",
"files",
".",
"create",
"(",
"{",
":key",
"=>",
"key",
",",
":body",
"=>",
"file",
",",
":public",
"... | Upload files from target to the source. | [
"Upload",
"files",
"from",
"target",
"to",
"the",
"source",
"."
] | 38495c68d46828641e85508610409fc8ad0ee2bb | https://github.com/polleverywhere/shart/blob/38495c68d46828641e85508610409fc8ad0ee2bb/lib/shart.rb#L86-L96 |
5,554 | polleverywhere/shart | lib/shart.rb | Shart.Sync.clean | def clean(&block)
@target.files.each do |object|
unless @source.files.include? object.key
block.call(object)
object.destroy
end
end
end | ruby | def clean(&block)
@target.files.each do |object|
unless @source.files.include? object.key
block.call(object)
object.destroy
end
end
end | [
"def",
"clean",
"(",
"&",
"block",
")",
"@target",
".",
"files",
".",
"each",
"do",
"|",
"object",
"|",
"unless",
"@source",
".",
"files",
".",
"include?",
"object",
".",
"key",
"block",
".",
"call",
"(",
"object",
")",
"object",
".",
"destroy",
"end... | Removes files from target that don't exist on the source. | [
"Removes",
"files",
"from",
"target",
"that",
"don",
"t",
"exist",
"on",
"the",
"source",
"."
] | 38495c68d46828641e85508610409fc8ad0ee2bb | https://github.com/polleverywhere/shart/blob/38495c68d46828641e85508610409fc8ad0ee2bb/lib/shart.rb#L99-L106 |
5,555 | rakeoe/rakeoe | lib/rakeoe/key_value_reader.rb | RakeOE.KeyValueReader.add | def add(key, value)
if @env.has_key?(key)
@env[key] += value
else
set(key,value)
end
end | ruby | def add(key, value)
if @env.has_key?(key)
@env[key] += value
else
set(key,value)
end
end | [
"def",
"add",
"(",
"key",
",",
"value",
")",
"if",
"@env",
".",
"has_key?",
"(",
"key",
")",
"@env",
"[",
"key",
"]",
"+=",
"value",
"else",
"set",
"(",
"key",
",",
"value",
")",
"end",
"end"
] | Adds a value for key
@param [String] key Key that should be used for operation
@param [String] value Value that should be used for operation | [
"Adds",
"a",
"value",
"for",
"key"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/key_value_reader.rb#L173-L179 |
5,556 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.handle_qt | def handle_qt
unless tc.qt.check_once
puts '### WARN: QT prerequisites not complete!'
end
@settings['ADD_CFLAGS'] += tc.qt.cflags
@settings['ADD_CXXFLAGS'] += tc.qt.cflags
@settings['ADD_LDFLAGS'] += tc.qt.ldflags
@settings['ADD_LIBS'] += tc.qt.libs
end | ruby | def handle_qt
unless tc.qt.check_once
puts '### WARN: QT prerequisites not complete!'
end
@settings['ADD_CFLAGS'] += tc.qt.cflags
@settings['ADD_CXXFLAGS'] += tc.qt.cflags
@settings['ADD_LDFLAGS'] += tc.qt.ldflags
@settings['ADD_LIBS'] += tc.qt.libs
end | [
"def",
"handle_qt",
"unless",
"tc",
".",
"qt",
".",
"check_once",
"puts",
"'### WARN: QT prerequisites not complete!'",
"end",
"@settings",
"[",
"'ADD_CFLAGS'",
"]",
"+=",
"tc",
".",
"qt",
".",
"cflags",
"@settings",
"[",
"'ADD_CXXFLAGS'",
"]",
"+=",
"tc",
".",
... | Qt special handling | [
"Qt",
"special",
"handling"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L122-L130 |
5,557 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.src_directories | def src_directories(main_dir, sub_dirs, params={})
if params[:subdir_only]
all_dirs=[]
else
all_dirs = [main_dir]
end
sub_dirs.each do |dir|
all_dirs << "#{main_dir}/#{dir}"
end
all_dirs.compact
end | ruby | def src_directories(main_dir, sub_dirs, params={})
if params[:subdir_only]
all_dirs=[]
else
all_dirs = [main_dir]
end
sub_dirs.each do |dir|
all_dirs << "#{main_dir}/#{dir}"
end
all_dirs.compact
end | [
"def",
"src_directories",
"(",
"main_dir",
",",
"sub_dirs",
",",
"params",
"=",
"{",
"}",
")",
"if",
"params",
"[",
":subdir_only",
"]",
"all_dirs",
"=",
"[",
"]",
"else",
"all_dirs",
"=",
"[",
"main_dir",
"]",
"end",
"sub_dirs",
".",
"each",
"do",
"|"... | Returns array of source code directories assembled via given parameters
@param [String] main_dir Main directory where project source is located
@param [Array] sub_dirs List of sub directories inside main_dir
@param [Hash] params Option hash to control how directorie... | [
"Returns",
"array",
"of",
"source",
"code",
"directories",
"assembled",
"via",
"given",
"parameters"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L160-L171 |
5,558 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.lib_incs | def lib_incs(libs=[])
includes = Array.new
libs.each do |name, param|
lib_includes = PrjFileCache.exported_lib_incs(name)
includes += lib_includes if lib_includes.any?
end
includes
end | ruby | def lib_incs(libs=[])
includes = Array.new
libs.each do |name, param|
lib_includes = PrjFileCache.exported_lib_incs(name)
includes += lib_includes if lib_includes.any?
end
includes
end | [
"def",
"lib_incs",
"(",
"libs",
"=",
"[",
"]",
")",
"includes",
"=",
"Array",
".",
"new",
"libs",
".",
"each",
"do",
"|",
"name",
",",
"param",
"|",
"lib_includes",
"=",
"PrjFileCache",
".",
"exported_lib_incs",
"(",
"name",
")",
"includes",
"+=",
"lib... | Returns list of include directories for name of libraries in parameter libs
@param [Array] libs List of library names
@return [Array] List of includes found for given library names | [
"Returns",
"list",
"of",
"include",
"directories",
"for",
"name",
"of",
"libraries",
"in",
"parameter",
"libs"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L180-L187 |
5,559 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.search_files | def search_files(directories, extensions)
extensions.each_with_object([]) do |ext, obj|
directories.each do |dir|
obj << FileList["#{dir}/*#{ext}"]
end
end.flatten.compact
end | ruby | def search_files(directories, extensions)
extensions.each_with_object([]) do |ext, obj|
directories.each do |dir|
obj << FileList["#{dir}/*#{ext}"]
end
end.flatten.compact
end | [
"def",
"search_files",
"(",
"directories",
",",
"extensions",
")",
"extensions",
".",
"each_with_object",
"(",
"[",
"]",
")",
"do",
"|",
"ext",
",",
"obj",
"|",
"directories",
".",
"each",
"do",
"|",
"dir",
"|",
"obj",
"<<",
"FileList",
"[",
"\"#{dir}/*#... | Search files recursively in directory with given extensions
@param [Array] directories Array of directories to search
@param [Array] extensions Array of file extensions to use for search
@return [Array] list of all found files | [
"Search",
"files",
"recursively",
"in",
"directory",
"with",
"given",
"extensions"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L197-L203 |
5,560 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.find_files_relative | def find_files_relative(directory, files)
return [] unless files.any?
files.each_with_object([]) do |file, obj|
path = "#{directory}/#{file}"
obj << path if File.exist?(path)
end
end | ruby | def find_files_relative(directory, files)
return [] unless files.any?
files.each_with_object([]) do |file, obj|
path = "#{directory}/#{file}"
obj << path if File.exist?(path)
end
end | [
"def",
"find_files_relative",
"(",
"directory",
",",
"files",
")",
"return",
"[",
"]",
"unless",
"files",
".",
"any?",
"files",
".",
"each_with_object",
"(",
"[",
"]",
")",
"do",
"|",
"file",
",",
"obj",
"|",
"path",
"=",
"\"#{directory}/#{file}\"",
"obj",... | Search list of files relative to given directory
@param [String] directory Main directory
@param [Array] files List with Filenames
@return [Array] List of path names of all found files | [
"Search",
"list",
"of",
"files",
"relative",
"to",
"given",
"directory"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L213-L219 |
5,561 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.read_prj_settings | def read_prj_settings(file)
unless File.file?(file)
file = File.dirname(__FILE__)+'/prj.rake'
end
KeyValueReader.new(file)
end | ruby | def read_prj_settings(file)
unless File.file?(file)
file = File.dirname(__FILE__)+'/prj.rake'
end
KeyValueReader.new(file)
end | [
"def",
"read_prj_settings",
"(",
"file",
")",
"unless",
"File",
".",
"file?",
"(",
"file",
")",
"file",
"=",
"File",
".",
"dirname",
"(",
"__FILE__",
")",
"+",
"'/prj.rake'",
"end",
"KeyValueReader",
".",
"new",
"(",
"file",
")",
"end"
] | Read project file if it exists
@param [String] file Filename of project file
@return [KeyValueReader] New KeyValueReader object with values provided via read project file | [
"Read",
"project",
"file",
"if",
"it",
"exists"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L239-L244 |
5,562 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.load_deps | def load_deps(deps)
deps.each do |file|
if File.file?(file)
Rake::MakefileLoader.new.load(file)
end
end
end | ruby | def load_deps(deps)
deps.each do |file|
if File.file?(file)
Rake::MakefileLoader.new.load(file)
end
end
end | [
"def",
"load_deps",
"(",
"deps",
")",
"deps",
".",
"each",
"do",
"|",
"file",
"|",
"if",
"File",
".",
"file?",
"(",
"file",
")",
"Rake",
"::",
"MakefileLoader",
".",
"new",
".",
"load",
"(",
"file",
")",
"end",
"end",
"end"
] | Loads dependency files if already generated
@param [Array] deps List of dependency files that have been generated via e.g. 'gcc -MM' | [
"Loads",
"dependency",
"files",
"if",
"already",
"generated"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L260-L266 |
5,563 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.obj_to_source | def obj_to_source(obj, source_dir, obj_dir)
stub = obj.gsub(obj_dir, source_dir).ext('')
src = stub_to_src(stub)
return src if src
raise "No matching source for #{obj} found."
end | ruby | def obj_to_source(obj, source_dir, obj_dir)
stub = obj.gsub(obj_dir, source_dir).ext('')
src = stub_to_src(stub)
return src if src
raise "No matching source for #{obj} found."
end | [
"def",
"obj_to_source",
"(",
"obj",
",",
"source_dir",
",",
"obj_dir",
")",
"stub",
"=",
"obj",
".",
"gsub",
"(",
"obj_dir",
",",
"source_dir",
")",
".",
"ext",
"(",
"''",
")",
"src",
"=",
"stub_to_src",
"(",
"stub",
")",
"return",
"src",
"if",
"src"... | Transforms an object file name to its source file name by replacing
build directory base with the source directory base and then iterating list of
known sources to match
@param [String] obj Object filename
@param [String] source_dir Project source base directory
@param [String] obj_dir Project build ... | [
"Transforms",
"an",
"object",
"file",
"name",
"to",
"its",
"source",
"file",
"name",
"by",
"replacing",
"build",
"directory",
"base",
"with",
"the",
"source",
"directory",
"base",
"and",
"then",
"iterating",
"list",
"of",
"known",
"sources",
"to",
"match"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L315-L320 |
5,564 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.dep_to_source | def dep_to_source(dep, source_dir, dep_dir)
stub = dep.gsub(dep_dir, source_dir).ext('')
src = stub_to_src(stub)
return src if src
raise "No matching source for #{dep} found."
end | ruby | def dep_to_source(dep, source_dir, dep_dir)
stub = dep.gsub(dep_dir, source_dir).ext('')
src = stub_to_src(stub)
return src if src
raise "No matching source for #{dep} found."
end | [
"def",
"dep_to_source",
"(",
"dep",
",",
"source_dir",
",",
"dep_dir",
")",
"stub",
"=",
"dep",
".",
"gsub",
"(",
"dep_dir",
",",
"source_dir",
")",
".",
"ext",
"(",
"''",
")",
"src",
"=",
"stub_to_src",
"(",
"stub",
")",
"return",
"src",
"if",
"src"... | Transforms a dependency file name into its corresponding source file name by replacing
file name extension and object directory with dependency directory.
Searches through list of source files to find it.
@param [String] dep Source filename
@param [String] source_dir Project source base directory
@param ... | [
"Transforms",
"a",
"dependency",
"file",
"name",
"into",
"its",
"corresponding",
"source",
"file",
"name",
"by",
"replacing",
"file",
"name",
"extension",
"and",
"object",
"directory",
"with",
"dependency",
"directory",
".",
"Searches",
"through",
"list",
"of",
... | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L369-L374 |
5,565 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.platform_flags_fixup | def platform_flags_fixup(libs)
libs[:all].each do |lib|
ps = tc.platform_settings_for(lib)
unless ps.empty?
@settings['ADD_CFLAGS'] += " #{ps[:CFLAGS]}" if ps[:CFLAGS]
@settings['ADD_CXXFLAGS'] += " #{ps[:CXXFLAGS]}" if ps[:CXXFLAGS]
# remove all -lXX settings from p... | ruby | def platform_flags_fixup(libs)
libs[:all].each do |lib|
ps = tc.platform_settings_for(lib)
unless ps.empty?
@settings['ADD_CFLAGS'] += " #{ps[:CFLAGS]}" if ps[:CFLAGS]
@settings['ADD_CXXFLAGS'] += " #{ps[:CXXFLAGS]}" if ps[:CXXFLAGS]
# remove all -lXX settings from p... | [
"def",
"platform_flags_fixup",
"(",
"libs",
")",
"libs",
"[",
":all",
"]",
".",
"each",
"do",
"|",
"lib",
"|",
"ps",
"=",
"tc",
".",
"platform_settings_for",
"(",
"lib",
")",
"unless",
"ps",
".",
"empty?",
"@settings",
"[",
"'ADD_CFLAGS'",
"]",
"+=",
"... | Change ADD_CFLAGS, ADD_CXXFLAGS, ADD_LDFLAGS according to settings in platform file.
@param libs [Array] Array of libraries to be considered | [
"Change",
"ADD_CFLAGS",
"ADD_CXXFLAGS",
"ADD_LDFLAGS",
"according",
"to",
"settings",
"in",
"platform",
"file",
"."
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L430-L442 |
5,566 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.search_libs | def search_libs(settings)
# get all libs specified in ADD_LIBS
search_libs = settings['ADD_LIBS'].split
our_lib_deps = []
search_libs.each do |lib|
our_lib_deps << lib
deps_of_lib = @@all_libs_and_deps[lib]
if deps_of_lib
our_lib_deps += deps_of_lib
end... | ruby | def search_libs(settings)
# get all libs specified in ADD_LIBS
search_libs = settings['ADD_LIBS'].split
our_lib_deps = []
search_libs.each do |lib|
our_lib_deps << lib
deps_of_lib = @@all_libs_and_deps[lib]
if deps_of_lib
our_lib_deps += deps_of_lib
end... | [
"def",
"search_libs",
"(",
"settings",
")",
"# get all libs specified in ADD_LIBS",
"search_libs",
"=",
"settings",
"[",
"'ADD_LIBS'",
"]",
".",
"split",
"our_lib_deps",
"=",
"[",
"]",
"search_libs",
".",
"each",
"do",
"|",
"lib",
"|",
"our_lib_deps",
"<<",
"lib... | Search dependent libraries as specified in ADD_LIBS setting
of prj.rake file
@param [String] settings The project settings definition
@return [Hash] Containing the following components mapped to an array:
@option return [Array] :local all local libs found by toolchain
@option re... | [
"Search",
"dependent",
"libraries",
"as",
"specified",
"in",
"ADD_LIBS",
"setting",
"of",
"prj",
".",
"rake",
"file"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L455-L487 |
5,567 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.paths_of_libs | def paths_of_libs(some_libs)
local_libs = Array.new
some_libs.each do |lib|
if PrjFileCache.contain?('LIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
elsif PrjFileCache.contain?('SOLIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
... | ruby | def paths_of_libs(some_libs)
local_libs = Array.new
some_libs.each do |lib|
if PrjFileCache.contain?('LIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
elsif PrjFileCache.contain?('SOLIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
... | [
"def",
"paths_of_libs",
"(",
"some_libs",
")",
"local_libs",
"=",
"Array",
".",
"new",
"some_libs",
".",
"each",
"do",
"|",
"lib",
"|",
"if",
"PrjFileCache",
".",
"contain?",
"(",
"'LIB'",
",",
"lib",
")",
"local_libs",
"<<",
"\"#{tc.settings['LIB_OUT']}/lib#{... | Returns absolute paths to given libraries, if they are local libraries
of the current project. | [
"Returns",
"absolute",
"paths",
"to",
"given",
"libraries",
"if",
"they",
"are",
"local",
"libraries",
"of",
"the",
"current",
"project",
"."
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L506-L518 |
5,568 | rakeoe/rakeoe | lib/rakeoe/binary_base.rb | RakeOE.BinaryBase.paths_of_local_libs | def paths_of_local_libs
local_libs = Array.new
each_local_lib() do |lib|
if PrjFileCache.contain?('LIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
elsif PrjFileCache.contain?('SOLIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
en... | ruby | def paths_of_local_libs
local_libs = Array.new
each_local_lib() do |lib|
if PrjFileCache.contain?('LIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
elsif PrjFileCache.contain?('SOLIB', lib)
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
en... | [
"def",
"paths_of_local_libs",
"local_libs",
"=",
"Array",
".",
"new",
"each_local_lib",
"(",
")",
"do",
"|",
"lib",
"|",
"if",
"PrjFileCache",
".",
"contain?",
"(",
"'LIB'",
",",
"lib",
")",
"local_libs",
"<<",
"\"#{tc.settings['LIB_OUT']}/lib#{lib}.a\"",
"elsif",... | Returns absolute paths to dependend local libraries, i.e. libraries
of the current project. | [
"Returns",
"absolute",
"paths",
"to",
"dependend",
"local",
"libraries",
"i",
".",
"e",
".",
"libraries",
"of",
"the",
"current",
"project",
"."
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/binary_base.rb#L523-L535 |
5,569 | eprothro/cassie | lib/cassie/statements/statement.rb | Cassie::Statements.Statement.to_cql | def to_cql
if statement.respond_to?(:cql) && statement.respond_to?(:params)
Cassie::Support::StatementParser.new(statement).to_cql
else
statement.to_s
end
end | ruby | def to_cql
if statement.respond_to?(:cql) && statement.respond_to?(:params)
Cassie::Support::StatementParser.new(statement).to_cql
else
statement.to_s
end
end | [
"def",
"to_cql",
"if",
"statement",
".",
"respond_to?",
"(",
":cql",
")",
"&&",
"statement",
".",
"respond_to?",
"(",
":params",
")",
"Cassie",
"::",
"Support",
"::",
"StatementParser",
".",
"new",
"(",
"statement",
")",
".",
"to_cql",
"else",
"statement",
... | A CQL string with inline parameters, representing the current statement
as it would be executed in a CQL shell
@note This CQL string does not include execution options like type hinting,
idempotency, consistency level, etc -- just the raw CQL instruction and values.
@return [String]
@example
statement.to_cql... | [
"A",
"CQL",
"string",
"with",
"inline",
"parameters",
"representing",
"the",
"current",
"statement",
"as",
"it",
"would",
"be",
"executed",
"in",
"a",
"CQL",
"shell"
] | 63e71d12d3549882147e715e427a16fd8e0aa210 | https://github.com/eprothro/cassie/blob/63e71d12d3549882147e715e427a16fd8e0aa210/lib/cassie/statements/statement.rb#L59-L65 |
5,570 | atmos/warden-googleapps | lib/warden-googleapps/gapps_openid.rb | OpenID.GoogleDiscovery.discover_user | def discover_user(domain, claimed_id)
url = fetch_host_meta(domain)
if url.nil?
return nil # Not a Google Apps domain
end
xrds = fetch_xrds(domain, url)
user_url, authority = get_user_xrds_url(xrds, claimed_id)
user_xrds = fetch_xrds(authority, user_url, false)
return i... | ruby | def discover_user(domain, claimed_id)
url = fetch_host_meta(domain)
if url.nil?
return nil # Not a Google Apps domain
end
xrds = fetch_xrds(domain, url)
user_url, authority = get_user_xrds_url(xrds, claimed_id)
user_xrds = fetch_xrds(authority, user_url, false)
return i... | [
"def",
"discover_user",
"(",
"domain",
",",
"claimed_id",
")",
"url",
"=",
"fetch_host_meta",
"(",
"domain",
")",
"if",
"url",
".",
"nil?",
"return",
"nil",
"# Not a Google Apps domain",
"end",
"xrds",
"=",
"fetch_xrds",
"(",
"domain",
",",
"url",
")",
"user... | Handles discovery for a user's claimed ID. | [
"Handles",
"discovery",
"for",
"a",
"user",
"s",
"claimed",
"ID",
"."
] | ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85 | https://github.com/atmos/warden-googleapps/blob/ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85/lib/warden-googleapps/gapps_openid.rb#L98-L110 |
5,571 | atmos/warden-googleapps | lib/warden-googleapps/gapps_openid.rb | OpenID.GoogleDiscovery.discover_site | def discover_site(domain)
url = fetch_host_meta(domain)
if url.nil?
return nil # Not a Google Apps domain
end
xrds = fetch_xrds(domain, url)
unless xrds.nil?
endpoints = OpenID::OpenIDServiceEndpoint.from_xrds(domain, xrds)
return [domain, OpenID.get_op_or_user_... | ruby | def discover_site(domain)
url = fetch_host_meta(domain)
if url.nil?
return nil # Not a Google Apps domain
end
xrds = fetch_xrds(domain, url)
unless xrds.nil?
endpoints = OpenID::OpenIDServiceEndpoint.from_xrds(domain, xrds)
return [domain, OpenID.get_op_or_user_... | [
"def",
"discover_site",
"(",
"domain",
")",
"url",
"=",
"fetch_host_meta",
"(",
"domain",
")",
"if",
"url",
".",
"nil?",
"return",
"nil",
"# Not a Google Apps domain",
"end",
"xrds",
"=",
"fetch_xrds",
"(",
"domain",
",",
"url",
")",
"unless",
"xrds",
".",
... | Handles discovery for a domain | [
"Handles",
"discovery",
"for",
"a",
"domain"
] | ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85 | https://github.com/atmos/warden-googleapps/blob/ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85/lib/warden-googleapps/gapps_openid.rb#L113-L124 |
5,572 | atmos/warden-googleapps | lib/warden-googleapps/gapps_openid.rb | OpenID.GoogleDiscovery.fetch_host_meta | def fetch_host_meta(domain)
cached_value = get_cache(domain)
return cached_value unless cached_value.nil?
host_meta_url = "https://www.google.com/accounts/o8/.well-known/host-meta?hd=#{CGI::escape(domain)}"
http_resp = OpenID.fetch(host_meta_url)
if http_resp.code != "200" and http_resp.c... | ruby | def fetch_host_meta(domain)
cached_value = get_cache(domain)
return cached_value unless cached_value.nil?
host_meta_url = "https://www.google.com/accounts/o8/.well-known/host-meta?hd=#{CGI::escape(domain)}"
http_resp = OpenID.fetch(host_meta_url)
if http_resp.code != "200" and http_resp.c... | [
"def",
"fetch_host_meta",
"(",
"domain",
")",
"cached_value",
"=",
"get_cache",
"(",
"domain",
")",
"return",
"cached_value",
"unless",
"cached_value",
".",
"nil?",
"host_meta_url",
"=",
"\"https://www.google.com/accounts/o8/.well-known/host-meta?hd=#{CGI::escape(domain)}\"",
... | Kickstart the discovery process by checking against Google's well-known location for hosted domains.
This gives us the location of the site's XRDS doc | [
"Kickstart",
"the",
"discovery",
"process",
"by",
"checking",
"against",
"Google",
"s",
"well",
"-",
"known",
"location",
"for",
"hosted",
"domains",
".",
"This",
"gives",
"us",
"the",
"location",
"of",
"the",
"site",
"s",
"XRDS",
"doc"
] | ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85 | https://github.com/atmos/warden-googleapps/blob/ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85/lib/warden-googleapps/gapps_openid.rb#L128-L143 |
5,573 | atmos/warden-googleapps | lib/warden-googleapps/gapps_openid.rb | OpenID.GoogleDiscovery.fetch_xrds | def fetch_xrds(authority, url, cache=true)
return if url.nil?
cached_xrds = get_cache(url)
return cached_xrds unless cached_xrds.nil?
http_resp = OpenID.fetch(url)
return if http_resp.code != "200" and http_resp.code != "206"
body = http_resp.body
signature = http_resp["Sign... | ruby | def fetch_xrds(authority, url, cache=true)
return if url.nil?
cached_xrds = get_cache(url)
return cached_xrds unless cached_xrds.nil?
http_resp = OpenID.fetch(url)
return if http_resp.code != "200" and http_resp.code != "206"
body = http_resp.body
signature = http_resp["Sign... | [
"def",
"fetch_xrds",
"(",
"authority",
",",
"url",
",",
"cache",
"=",
"true",
")",
"return",
"if",
"url",
".",
"nil?",
"cached_xrds",
"=",
"get_cache",
"(",
"url",
")",
"return",
"cached_xrds",
"unless",
"cached_xrds",
".",
"nil?",
"http_resp",
"=",
"OpenI... | Fetches the XRDS and verifies the signature and authority for the doc | [
"Fetches",
"the",
"XRDS",
"and",
"verifies",
"the",
"signature",
"and",
"authority",
"for",
"the",
"doc"
] | ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85 | https://github.com/atmos/warden-googleapps/blob/ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85/lib/warden-googleapps/gapps_openid.rb#L146-L168 |
5,574 | atmos/warden-googleapps | lib/warden-googleapps/gapps_openid.rb | OpenID.GoogleDiscovery.get_user_xrds_url | def get_user_xrds_url(xrds, claimed_id)
types_to_match = ['http://www.iana.org/assignments/relation/describedby']
services = OpenID::Yadis::apply_filter(claimed_id, xrds)
services.each do | service |
if service.match_types(types_to_match)
template = REXML::XPath.first(service.service... | ruby | def get_user_xrds_url(xrds, claimed_id)
types_to_match = ['http://www.iana.org/assignments/relation/describedby']
services = OpenID::Yadis::apply_filter(claimed_id, xrds)
services.each do | service |
if service.match_types(types_to_match)
template = REXML::XPath.first(service.service... | [
"def",
"get_user_xrds_url",
"(",
"xrds",
",",
"claimed_id",
")",
"types_to_match",
"=",
"[",
"'http://www.iana.org/assignments/relation/describedby'",
"]",
"services",
"=",
"OpenID",
"::",
"Yadis",
"::",
"apply_filter",
"(",
"claimed_id",
",",
"xrds",
")",
"services",... | Process the URITemplate in the XRDS to derive the location of the claimed id's XRDS | [
"Process",
"the",
"URITemplate",
"in",
"the",
"XRDS",
"to",
"derive",
"the",
"location",
"of",
"the",
"claimed",
"id",
"s",
"XRDS"
] | ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85 | https://github.com/atmos/warden-googleapps/blob/ca05e09eb8ad8d992df73cf8bd9eb1f097a4de85/lib/warden-googleapps/gapps_openid.rb#L171-L182 |
5,575 | cheeyeo/pipeline | lib/pipeline/builder.rb | Pipeline.Builder.build_operation_chain | def build_operation_chain(stack)
empty_op = EmptyOperation.new(nil)
stack.reverse.reduce(empty_op) do |next_op, current_op|
klass, args, block = current_op
if Class === klass
klass.new(next_op, *args, &block)
elsif Proc === klass
lambda do |env|
next... | ruby | def build_operation_chain(stack)
empty_op = EmptyOperation.new(nil)
stack.reverse.reduce(empty_op) do |next_op, current_op|
klass, args, block = current_op
if Class === klass
klass.new(next_op, *args, &block)
elsif Proc === klass
lambda do |env|
next... | [
"def",
"build_operation_chain",
"(",
"stack",
")",
"empty_op",
"=",
"EmptyOperation",
".",
"new",
"(",
"nil",
")",
"stack",
".",
"reverse",
".",
"reduce",
"(",
"empty_op",
")",
"do",
"|",
"next_op",
",",
"current_op",
"|",
"klass",
",",
"args",
",",
"blo... | Iterate through the stack and build a single
callable object which consists of each operation
referencing the next one in the chain | [
"Iterate",
"through",
"the",
"stack",
"and",
"build",
"a",
"single",
"callable",
"object",
"which",
"consists",
"of",
"each",
"operation",
"referencing",
"the",
"next",
"one",
"in",
"the",
"chain"
] | e31fc1c99fa9f9600479494f43479581d546349c | https://github.com/cheeyeo/pipeline/blob/e31fc1c99fa9f9600479494f43479581d546349c/lib/pipeline/builder.rb#L43-L59 |
5,576 | robertwahler/repo_manager | lib/repo_manager/assets/base_asset.rb | RepoManager.BaseAsset.method_missing | def method_missing(name, *args, &block)
return attributes[name.to_sym] if attributes.include?(name.to_sym)
return super
end | ruby | def method_missing(name, *args, &block)
return attributes[name.to_sym] if attributes.include?(name.to_sym)
return super
end | [
"def",
"method_missing",
"(",
"name",
",",
"*",
"args",
",",
"&",
"block",
")",
"return",
"attributes",
"[",
"name",
".",
"to_sym",
"]",
"if",
"attributes",
".",
"include?",
"(",
"name",
".",
"to_sym",
")",
"return",
"super",
"end"
] | support for Mustache rendering of ad hoc user defined variables
if the key exists in the hash, use if for a lookup | [
"support",
"for",
"Mustache",
"rendering",
"of",
"ad",
"hoc",
"user",
"defined",
"variables",
"if",
"the",
"key",
"exists",
"in",
"the",
"hash",
"use",
"if",
"for",
"a",
"lookup"
] | d945f1cb6ac48b5689b633fcc029fd77c6a02d09 | https://github.com/robertwahler/repo_manager/blob/d945f1cb6ac48b5689b633fcc029fd77c6a02d09/lib/repo_manager/assets/base_asset.rb#L187-L190 |
5,577 | aelogica/express_templates | lib/arbre/patches.rb | Arbre.Element.helper_method | def helper_method(name, *args, &block)
if name.match /_path$/
helpers.send(name, *args, &block)
elsif (const_get([name, 'engine'].join('/').classify) rescue nil)
helpers.send(name, *args, &block)
else
current_arbre_element.add_child helpers.send(name, *args, &block)
end
... | ruby | def helper_method(name, *args, &block)
if name.match /_path$/
helpers.send(name, *args, &block)
elsif (const_get([name, 'engine'].join('/').classify) rescue nil)
helpers.send(name, *args, &block)
else
current_arbre_element.add_child helpers.send(name, *args, &block)
end
... | [
"def",
"helper_method",
"(",
"name",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"name",
".",
"match",
"/",
"/",
"helpers",
".",
"send",
"(",
"name",
",",
"args",
",",
"block",
")",
"elsif",
"(",
"const_get",
"(",
"[",
"name",
",",
"'engine'",
... | In order to not pollute our templates with helpers. prefixed
everywhere we want to try to distinguish helpers that are almost
always used as parameters to other methods such as path helpers
and not add them as elements | [
"In",
"order",
"to",
"not",
"pollute",
"our",
"templates",
"with",
"helpers",
".",
"prefixed",
"everywhere",
"we",
"want",
"to",
"try",
"to",
"distinguish",
"helpers",
"that",
"are",
"almost",
"always",
"used",
"as",
"parameters",
"to",
"other",
"methods",
"... | d5d447357e737c9220ca0025feb9e6f8f6249b5b | https://github.com/aelogica/express_templates/blob/d5d447357e737c9220ca0025feb9e6f8f6249b5b/lib/arbre/patches.rb#L64-L72 |
5,578 | knut2/todonotes | lib/todonotes/todonotes.rb | Todonotes.Todonotes.log2file | def log2file(filename = File.basename($0) + '.todo', level = Log4r::ALL)
@logger.add( Log4r::FileOutputter.new('ToDo',
:filename => filename,
:level => level,
:formatter => FixmeFormatter
... | ruby | def log2file(filename = File.basename($0) + '.todo', level = Log4r::ALL)
@logger.add( Log4r::FileOutputter.new('ToDo',
:filename => filename,
:level => level,
:formatter => FixmeFormatter
... | [
"def",
"log2file",
"(",
"filename",
"=",
"File",
".",
"basename",
"(",
"$0",
")",
"+",
"'.todo'",
",",
"level",
"=",
"Log4r",
"::",
"ALL",
")",
"@logger",
".",
"add",
"(",
"Log4r",
"::",
"FileOutputter",
".",
"new",
"(",
"'ToDo'",
",",
":filename",
"... | =begin rdoc
Write the todo's in a logging file.
Default filename is $0.todo
=end | [
"=",
"begin",
"rdoc",
"Write",
"the",
"todo",
"s",
"in",
"a",
"logging",
"file",
"."
] | 67e6e9402d2e67fb0cda320669dd33d737351fa4 | https://github.com/knut2/todonotes/blob/67e6e9402d2e67fb0cda320669dd33d737351fa4/lib/todonotes/todonotes.rb#L46-L53 |
5,579 | duritong/ruby-cobbler | lib/cobbler/base.rb | Cobbler.Base.save | def save
unless [ :handle, :new, :modify, :save ].all?{|method| api_methods[method] }
raise "Not all necessary api methods are defined to process this action!"
end
entry = self.class.find_one(name)
self.class.in_transaction(true) do |token|
... | ruby | def save
unless [ :handle, :new, :modify, :save ].all?{|method| api_methods[method] }
raise "Not all necessary api methods are defined to process this action!"
end
entry = self.class.find_one(name)
self.class.in_transaction(true) do |token|
... | [
"def",
"save",
"unless",
"[",
":handle",
",",
":new",
",",
":modify",
",",
":save",
"]",
".",
"all?",
"{",
"|",
"method",
"|",
"api_methods",
"[",
"method",
"]",
"}",
"raise",
"\"Not all necessary api methods are defined to process this action!\"",
"end",
"entry",... | Save an item on the remote cobbler server
This will first lookup if the item already exists on the remote server
and use its handle store the attributes. Otherwise a new item is created. | [
"Save",
"an",
"item",
"on",
"the",
"remote",
"cobbler",
"server",
"This",
"will",
"first",
"lookup",
"if",
"the",
"item",
"already",
"exists",
"on",
"the",
"remote",
"server",
"and",
"use",
"its",
"handle",
"store",
"the",
"attributes",
".",
"Otherwise",
"... | bb0c49c3a8325b0861aef25e8994c468e910cb12 | https://github.com/duritong/ruby-cobbler/blob/bb0c49c3a8325b0861aef25e8994c468e910cb12/lib/cobbler/base.rb#L93-L119 |
5,580 | duritong/ruby-cobbler | lib/cobbler/base.rb | Cobbler.Base.remove | def remove
raise "Not all necessary api methods are defined to process this action!" unless api_methods[:remove]
self.class.in_transaction(true) do |token|
self.class.make_call(api_methods[:remove],name,token)
end
end | ruby | def remove
raise "Not all necessary api methods are defined to process this action!" unless api_methods[:remove]
self.class.in_transaction(true) do |token|
self.class.make_call(api_methods[:remove],name,token)
end
end | [
"def",
"remove",
"raise",
"\"Not all necessary api methods are defined to process this action!\"",
"unless",
"api_methods",
"[",
":remove",
"]",
"self",
".",
"class",
".",
"in_transaction",
"(",
"true",
")",
"do",
"|",
"token",
"|",
"self",
".",
"class",
".",
"make_... | delete the item on the cobbler server | [
"delete",
"the",
"item",
"on",
"the",
"cobbler",
"server"
] | bb0c49c3a8325b0861aef25e8994c468e910cb12 | https://github.com/duritong/ruby-cobbler/blob/bb0c49c3a8325b0861aef25e8994c468e910cb12/lib/cobbler/base.rb#L122-L127 |
5,581 | duritong/ruby-cobbler | lib/cobbler/base.rb | Cobbler.Base.copy | def copy(newname)
raise "Not all necessary api methods are defined to process this action!" unless api_methods[:copy]
entry = self.class.find_one(name)
if entry
self.class.in_transaction(true) do |token|
entryid = self.class.make_call(api_methods[:... | ruby | def copy(newname)
raise "Not all necessary api methods are defined to process this action!" unless api_methods[:copy]
entry = self.class.find_one(name)
if entry
self.class.in_transaction(true) do |token|
entryid = self.class.make_call(api_methods[:... | [
"def",
"copy",
"(",
"newname",
")",
"raise",
"\"Not all necessary api methods are defined to process this action!\"",
"unless",
"api_methods",
"[",
":copy",
"]",
"entry",
"=",
"self",
".",
"class",
".",
"find_one",
"(",
"name",
")",
"if",
"entry",
"self",
".",
"cl... | copy the item on the cobbler server | [
"copy",
"the",
"item",
"on",
"the",
"cobbler",
"server"
] | bb0c49c3a8325b0861aef25e8994c468e910cb12 | https://github.com/duritong/ruby-cobbler/blob/bb0c49c3a8325b0861aef25e8994c468e910cb12/lib/cobbler/base.rb#L130-L139 |
5,582 | suculent/apprepo | lib/apprepo/setup.rb | AppRepo.Setup.generate_apprepo_file | def generate_apprepo_file(_apprepo_path, options)
# v = options[:app].latest_version
# generate_apprepo_file(v, File.join(apprepo_path, 'manifest.json'))
# Generate the final Repofile here
gem_path = Helper.gem_path('apprepo')
apprepo = File.read("#{gem_path}/../assets/RepofileDefault")
... | ruby | def generate_apprepo_file(_apprepo_path, options)
# v = options[:app].latest_version
# generate_apprepo_file(v, File.join(apprepo_path, 'manifest.json'))
# Generate the final Repofile here
gem_path = Helper.gem_path('apprepo')
apprepo = File.read("#{gem_path}/../assets/RepofileDefault")
... | [
"def",
"generate_apprepo_file",
"(",
"_apprepo_path",
",",
"options",
")",
"# v = options[:app].latest_version",
"# generate_apprepo_file(v, File.join(apprepo_path, 'manifest.json'))",
"# Generate the final Repofile here",
"gem_path",
"=",
"Helper",
".",
"gem_path",
"(",
"'apprepo'",... | This method takes care of creating a new 'apprepo' folder with metadata
and screenshots folders | [
"This",
"method",
"takes",
"care",
"of",
"creating",
"a",
"new",
"apprepo",
"folder",
"with",
"metadata",
"and",
"screenshots",
"folders"
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/setup.rb#L16-L28 |
5,583 | grzlus/acts_as_nested_interval | lib/acts_as_nested_interval/class_methods.rb | ActsAsNestedInterval.ClassMethods.rebuild_nested_interval_tree! | def rebuild_nested_interval_tree!
# temporary changes
skip_callback :update, :before, :update_nested_interval
old_default_scopes = default_scopes # save to revert later
default_scope ->{ where("#{quoted_table_name}.lftq > 0") } # use lft1 > 0 as a "migrated?" flag
# zero all int... | ruby | def rebuild_nested_interval_tree!
# temporary changes
skip_callback :update, :before, :update_nested_interval
old_default_scopes = default_scopes # save to revert later
default_scope ->{ where("#{quoted_table_name}.lftq > 0") } # use lft1 > 0 as a "migrated?" flag
# zero all int... | [
"def",
"rebuild_nested_interval_tree!",
"# temporary changes",
"skip_callback",
":update",
",",
":before",
",",
":update_nested_interval",
"old_default_scopes",
"=",
"default_scopes",
"# save to revert later",
"default_scope",
"->",
"{",
"where",
"(",
"\"#{quoted_table_name}.lftq... | Rebuild the intervals tree | [
"Rebuild",
"the",
"intervals",
"tree"
] | 9a588bf515570e4a1e1311dc58dc5eea8bfffd8e | https://github.com/grzlus/acts_as_nested_interval/blob/9a588bf515570e4a1e1311dc58dc5eea8bfffd8e/lib/acts_as_nested_interval/class_methods.rb#L5-L31 |
5,584 | bachya/cliutils | lib/cliutils/prefs/pref.rb | CLIUtils.Pref.deliver | def deliver(default = nil)
# Design decision: the pre-prompt behavior
# gets evaluated *once*, not every time the
# user gets prompted. This prevents multiple
# evaluations when bad options are provided.
_eval_pre if @pre
valid_option_chosen = false
until valid_option_chosen
... | ruby | def deliver(default = nil)
# Design decision: the pre-prompt behavior
# gets evaluated *once*, not every time the
# user gets prompted. This prevents multiple
# evaluations when bad options are provided.
_eval_pre if @pre
valid_option_chosen = false
until valid_option_chosen
... | [
"def",
"deliver",
"(",
"default",
"=",
"nil",
")",
"# Design decision: the pre-prompt behavior",
"# gets evaluated *once*, not every time the",
"# user gets prompted. This prevents multiple",
"# evaluations when bad options are provided.",
"_eval_pre",
"if",
"@pre",
"valid_option_chosen"... | Initializes a new Pref via passed-in parameters. Also
initializes objects for each Validator and Behavior on
this Pref.
@param [Hash] params Parameters to initialize
@return [void]
Custom equality operator for this class.
@param [Pref] other
@return [Boolean]
Delivers the prompt the user. Handles retries
after... | [
"Initializes",
"a",
"new",
"Pref",
"via",
"passed",
"-",
"in",
"parameters",
".",
"Also",
"initializes",
"objects",
"for",
"each",
"Validator",
"and",
"Behavior",
"on",
"this",
"Pref",
"."
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/prefs/pref.rb#L114-L132 |
5,585 | bachya/cliutils | lib/cliutils/prefs/pref.rb | CLIUtils.Pref.evaluate_behaviors | def evaluate_behaviors(text)
modified_text = text
if @behavior_objects
@behavior_objects.each do |b|
modified_text = b.evaluate(modified_text)
end
end
modified_text
end | ruby | def evaluate_behaviors(text)
modified_text = text
if @behavior_objects
@behavior_objects.each do |b|
modified_text = b.evaluate(modified_text)
end
end
modified_text
end | [
"def",
"evaluate_behaviors",
"(",
"text",
")",
"modified_text",
"=",
"text",
"if",
"@behavior_objects",
"@behavior_objects",
".",
"each",
"do",
"|",
"b",
"|",
"modified_text",
"=",
"b",
".",
"evaluate",
"(",
"modified_text",
")",
"end",
"end",
"modified_text",
... | Runs the passed text through this Pref's behaviors.
@param [String] text The text to evaluate
@return [String] | [
"Runs",
"the",
"passed",
"text",
"through",
"this",
"Pref",
"s",
"behaviors",
"."
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/prefs/pref.rb#L137-L145 |
5,586 | bachya/cliutils | lib/cliutils/prefs/pref.rb | CLIUtils.Pref._check_validators | def _check_validators(text)
ret = true
if @validator_objects
@validator_objects.each do |v|
v.validate(text)
unless v.is_valid
@last_error_message = v.message
ret = false
end
end
end
ret
end | ruby | def _check_validators(text)
ret = true
if @validator_objects
@validator_objects.each do |v|
v.validate(text)
unless v.is_valid
@last_error_message = v.message
ret = false
end
end
end
ret
end | [
"def",
"_check_validators",
"(",
"text",
")",
"ret",
"=",
"true",
"if",
"@validator_objects",
"@validator_objects",
".",
"each",
"do",
"|",
"v",
"|",
"v",
".",
"validate",
"(",
"text",
")",
"unless",
"v",
".",
"is_valid",
"@last_error_message",
"=",
"v",
"... | Validates a text against the validators for this Pref
@param [String] text The text to validate
@return [Boolean] | [
"Validates",
"a",
"text",
"against",
"the",
"validators",
"for",
"this",
"Pref"
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/prefs/pref.rb#L176-L188 |
5,587 | bachya/cliutils | lib/cliutils/prefs/pref.rb | CLIUtils.Pref._init_action | def _init_action(action_hash)
obj = _load_asset(ASSET_TYPE_ACTION, action_hash[:name])
obj.parameters = action_hash[:parameters]
obj
end | ruby | def _init_action(action_hash)
obj = _load_asset(ASSET_TYPE_ACTION, action_hash[:name])
obj.parameters = action_hash[:parameters]
obj
end | [
"def",
"_init_action",
"(",
"action_hash",
")",
"obj",
"=",
"_load_asset",
"(",
"ASSET_TYPE_ACTION",
",",
"action_hash",
"[",
":name",
"]",
")",
"obj",
".",
"parameters",
"=",
"action_hash",
"[",
":parameters",
"]",
"obj",
"end"
] | Attempts to instantiate a Pre or Post Action based on name; if
successful, the new object gets placed in @validator_objects
@param [Hash] action_hash The hash of action data (name, params, etc.)
@return [void] | [
"Attempts",
"to",
"instantiate",
"a",
"Pre",
"or",
"Post",
"Action",
"based",
"on",
"name",
";",
"if",
"successful",
"the",
"new",
"object",
"gets",
"placed",
"in"
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/prefs/pref.rb#L216-L220 |
5,588 | bachya/cliutils | lib/cliutils/prefs/pref.rb | CLIUtils.Pref._init_and_add_behavior | def _init_and_add_behavior(behavior_hash)
obj = _load_asset(ASSET_TYPE_BEHAVIOR, behavior_hash[:name])
unless obj.nil?
obj.parameters = behavior_hash[:parameters]
@behavior_objects << obj
end
end | ruby | def _init_and_add_behavior(behavior_hash)
obj = _load_asset(ASSET_TYPE_BEHAVIOR, behavior_hash[:name])
unless obj.nil?
obj.parameters = behavior_hash[:parameters]
@behavior_objects << obj
end
end | [
"def",
"_init_and_add_behavior",
"(",
"behavior_hash",
")",
"obj",
"=",
"_load_asset",
"(",
"ASSET_TYPE_BEHAVIOR",
",",
"behavior_hash",
"[",
":name",
"]",
")",
"unless",
"obj",
".",
"nil?",
"obj",
".",
"parameters",
"=",
"behavior_hash",
"[",
":parameters",
"]"... | Attempts to instantiate a Behavior based on name; if
successful, the new object gets placed in @behavior_objects
@param [Hash] behavior_hash The Behavior attributes
@return [void] | [
"Attempts",
"to",
"instantiate",
"a",
"Behavior",
"based",
"on",
"name",
";",
"if",
"successful",
"the",
"new",
"object",
"gets",
"placed",
"in"
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/prefs/pref.rb#L226-L232 |
5,589 | ktemkin/ruby-ise | lib/ise/symbol.rb | ISE.Symbol.each_attribute | def each_attribute
#If we weren't passed a block, return an enumerator referencing this function.
return enum_for(:each_attribute) unless block_given?
#Yield each of the known attributes in turn.
@xml.css("symbol attr").each do |attr|
yield attr.attribute('name').value, attr.attr... | ruby | def each_attribute
#If we weren't passed a block, return an enumerator referencing this function.
return enum_for(:each_attribute) unless block_given?
#Yield each of the known attributes in turn.
@xml.css("symbol attr").each do |attr|
yield attr.attribute('name').value, attr.attr... | [
"def",
"each_attribute",
"#If we weren't passed a block, return an enumerator referencing this function.",
"return",
"enum_for",
"(",
":each_attribute",
")",
"unless",
"block_given?",
"#Yield each of the known attributes in turn.",
"@xml",
".",
"css",
"(",
"\"symbol attr\"",
")",
"... | Iterates over each attribute present in the given symbol. | [
"Iterates",
"over",
"each",
"attribute",
"present",
"in",
"the",
"given",
"symbol",
"."
] | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/symbol.rb#L76-L86 |
5,590 | ktemkin/ruby-ise | lib/ise/symbol.rb | ISE.Symbol.set_pin_name | def set_pin_name(node, name)
return unless node.name == "pin"
#Change the name of any pin-label "text attributes" that reference the given pin.
original_name = get_pin_name(node)
#Retrieve a collection of all attributes that match the pin's original name...
pin_labels = @xml.css("symbol... | ruby | def set_pin_name(node, name)
return unless node.name == "pin"
#Change the name of any pin-label "text attributes" that reference the given pin.
original_name = get_pin_name(node)
#Retrieve a collection of all attributes that match the pin's original name...
pin_labels = @xml.css("symbol... | [
"def",
"set_pin_name",
"(",
"node",
",",
"name",
")",
"return",
"unless",
"node",
".",
"name",
"==",
"\"pin\"",
"#Change the name of any pin-label \"text attributes\" that reference the given pin.",
"original_name",
"=",
"get_pin_name",
"(",
"node",
")",
"#Retrieve a collec... | Sets name of the pin represented by the given node, updating all values | [
"Sets",
"name",
"of",
"the",
"pin",
"represented",
"by",
"the",
"given",
"node",
"updating",
"all",
"values"
] | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/symbol.rb#L138-L154 |
5,591 | ktemkin/ruby-ise | lib/ise/symbol.rb | ISE.Symbol.set_pin_width! | def set_pin_width!(node, width)
#Get the components of the given bus' name.
_, left, right = parse_pin_name(get_pin_name(node))
#If the pin wasn't initially a bus, make it one.
left ||= 0
right ||= 0
#If our right bound is greater than our left one, adjust it.
if right > le... | ruby | def set_pin_width!(node, width)
#Get the components of the given bus' name.
_, left, right = parse_pin_name(get_pin_name(node))
#If the pin wasn't initially a bus, make it one.
left ||= 0
right ||= 0
#If our right bound is greater than our left one, adjust it.
if right > le... | [
"def",
"set_pin_width!",
"(",
"node",
",",
"width",
")",
"#Get the components of the given bus' name.",
"_",
",",
"left",
",",
"right",
"=",
"parse_pin_name",
"(",
"get_pin_name",
"(",
"node",
")",
")",
"#If the pin wasn't initially a bus, make it one.",
"left",
"||=",
... | Adjusts the "bounds" of the given bus so the bus is of the provided width
by modifying the bus's upper bound. If the node is not a bus, it will be
made into a bus whose right bound is 0.
node: The node to be modified.
width: The width to apply. | [
"Adjusts",
"the",
"bounds",
"of",
"the",
"given",
"bus",
"so",
"the",
"bus",
"is",
"of",
"the",
"provided",
"width",
"by",
"modifying",
"the",
"bus",
"s",
"upper",
"bound",
".",
"If",
"the",
"node",
"is",
"not",
"a",
"bus",
"it",
"will",
"be",
"made"... | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/symbol.rb#L181-L201 |
5,592 | praxis/praxis-blueprints | lib/praxis-blueprints/blueprint.rb | Praxis.Blueprint.render | def render(view_name = nil, context: Attributor::DEFAULT_ROOT_CONTEXT, renderer: Renderer.new, **opts)
if !view_name.nil?
warn 'DEPRECATED: please do not pass the view name as the first parameter in Blueprint.render, pass through the view: named param instead.'
elsif opts.key?(:view)
view_na... | ruby | def render(view_name = nil, context: Attributor::DEFAULT_ROOT_CONTEXT, renderer: Renderer.new, **opts)
if !view_name.nil?
warn 'DEPRECATED: please do not pass the view name as the first parameter in Blueprint.render, pass through the view: named param instead.'
elsif opts.key?(:view)
view_na... | [
"def",
"render",
"(",
"view_name",
"=",
"nil",
",",
"context",
":",
"Attributor",
"::",
"DEFAULT_ROOT_CONTEXT",
",",
"renderer",
":",
"Renderer",
".",
"new",
",",
"**",
"opts",
")",
"if",
"!",
"view_name",
".",
"nil?",
"warn",
"'DEPRECATED: please do not pass ... | Render the wrapped data with the given view | [
"Render",
"the",
"wrapped",
"data",
"with",
"the",
"given",
"view"
] | 57b9f9d81d313a7c7bf3e9eebb4b8153c3b48f1c | https://github.com/praxis/praxis-blueprints/blob/57b9f9d81d313a7c7bf3e9eebb4b8153c3b48f1c/lib/praxis-blueprints/blueprint.rb#L293-L319 |
5,593 | eprothro/cassie | lib/cassie/schema/migration/dsl/column_operations.rb | Cassie::Schema::Migration::DSL.ColumnOperations.add_column | def add_column(table_name, column_name, type, options = {})
table_definition = TableDefinition.new
if !table_definition.respond_to?(type)
raise Errors::MigrationDefinitionError("Type '#{type}' is not valid for cassandra migration.")
end
table_definition.send(type, column_name, options)... | ruby | def add_column(table_name, column_name, type, options = {})
table_definition = TableDefinition.new
if !table_definition.respond_to?(type)
raise Errors::MigrationDefinitionError("Type '#{type}' is not valid for cassandra migration.")
end
table_definition.send(type, column_name, options)... | [
"def",
"add_column",
"(",
"table_name",
",",
"column_name",
",",
"type",
",",
"options",
"=",
"{",
"}",
")",
"table_definition",
"=",
"TableDefinition",
".",
"new",
"if",
"!",
"table_definition",
".",
"respond_to?",
"(",
"type",
")",
"raise",
"Errors",
"::",... | Adds a column to a table.
options: same options you would pass to create a table with that column
(i.e. :limit might be applicable) | [
"Adds",
"a",
"column",
"to",
"a",
"table",
"."
] | 63e71d12d3549882147e715e427a16fd8e0aa210 | https://github.com/eprothro/cassie/blob/63e71d12d3549882147e715e427a16fd8e0aa210/lib/cassie/schema/migration/dsl/column_operations.rb#L14-L30 |
5,594 | xlab-si/server-sent-events-ruby | lib/server_sent_events/client.rb | ServerSentEvents.Client.listen | def listen
Net::HTTP.start(@address.host, @address.port) do |http|
# TODO(@tadeboro): Add support for adding custom headers (auth)
http.request(Net::HTTP::Get.new(@address)) do |response|
# TODO(@tadeboro): Handle non-200 here
response.read_body do |chunk|
@parser.p... | ruby | def listen
Net::HTTP.start(@address.host, @address.port) do |http|
# TODO(@tadeboro): Add support for adding custom headers (auth)
http.request(Net::HTTP::Get.new(@address)) do |response|
# TODO(@tadeboro): Handle non-200 here
response.read_body do |chunk|
@parser.p... | [
"def",
"listen",
"Net",
"::",
"HTTP",
".",
"start",
"(",
"@address",
".",
"host",
",",
"@address",
".",
"port",
")",
"do",
"|",
"http",
"|",
"# TODO(@tadeboro): Add support for adding custom headers (auth)",
"http",
".",
"request",
"(",
"Net",
"::",
"HTTP",
":... | Create new SSE client.
Note that creating new client does not establish connection to the
server. Connection is established by the {#listen} call and torn down
automatically when {#listen returns}.
@param address [URI] endpoint to connect to
@param parser [Parser] object that should be used to parse incoming dat... | [
"Create",
"new",
"SSE",
"client",
"."
] | f57491a8ab3b08662f657668d3ffe6725dd251db | https://github.com/xlab-si/server-sent-events-ruby/blob/f57491a8ab3b08662f657668d3ffe6725dd251db/lib/server_sent_events/client.rb#L33-L43 |
5,595 | dennmart/wanikani-gem | lib/wanikani/srs.rb | Wanikani.SRS.srs_distribution | def srs_distribution(item_type = "all")
raise ArgumentError, "Please use a valid SRS type (or none for all types)" if !ITEM_TYPES.include?(item_type)
response = api_response("srs-distribution")
srs_distribution = response["requested_information"]
return srs_distribution if item_type == "all"
... | ruby | def srs_distribution(item_type = "all")
raise ArgumentError, "Please use a valid SRS type (or none for all types)" if !ITEM_TYPES.include?(item_type)
response = api_response("srs-distribution")
srs_distribution = response["requested_information"]
return srs_distribution if item_type == "all"
... | [
"def",
"srs_distribution",
"(",
"item_type",
"=",
"\"all\"",
")",
"raise",
"ArgumentError",
",",
"\"Please use a valid SRS type (or none for all types)\"",
"if",
"!",
"ITEM_TYPES",
".",
"include?",
"(",
"item_type",
")",
"response",
"=",
"api_response",
"(",
"\"srs-dist... | Gets the counts for each SRS level and item types.
@param item_type [String] the SRS level that will be returned.
@return [Hash] the SRS information for each level for the user. | [
"Gets",
"the",
"counts",
"for",
"each",
"SRS",
"level",
"and",
"item",
"types",
"."
] | 70f9e4289f758c9663c0ee4d1172acb711487df9 | https://github.com/dennmart/wanikani-gem/blob/70f9e4289f758c9663c0ee4d1172acb711487df9/lib/wanikani/srs.rb#L10-L18 |
5,596 | dennmart/wanikani-gem | lib/wanikani/srs.rb | Wanikani.SRS.srs_items_by_type | def srs_items_by_type(item_type)
raise ArgumentError, "Please use a valid SRS type." if !ITEM_TYPES.include?(item_type) || item_type == "all"
items_by_type = []
%w(radicals kanji vocabulary).each do |type|
items = send("#{type}_list")
items.reject! { |item| item["user_specific"].nil? ... | ruby | def srs_items_by_type(item_type)
raise ArgumentError, "Please use a valid SRS type." if !ITEM_TYPES.include?(item_type) || item_type == "all"
items_by_type = []
%w(radicals kanji vocabulary).each do |type|
items = send("#{type}_list")
items.reject! { |item| item["user_specific"].nil? ... | [
"def",
"srs_items_by_type",
"(",
"item_type",
")",
"raise",
"ArgumentError",
",",
"\"Please use a valid SRS type.\"",
"if",
"!",
"ITEM_TYPES",
".",
"include?",
"(",
"item_type",
")",
"||",
"item_type",
"==",
"\"all\"",
"items_by_type",
"=",
"[",
"]",
"%w(",
"radic... | Gets all items for a specific SRS level.
@param item_type [String] the SRS level for the items returned.
@return [Array<Hash>] all the items matching the specified SRS for each level for the user. | [
"Gets",
"all",
"items",
"for",
"a",
"specific",
"SRS",
"level",
"."
] | 70f9e4289f758c9663c0ee4d1172acb711487df9 | https://github.com/dennmart/wanikani-gem/blob/70f9e4289f758c9663c0ee4d1172acb711487df9/lib/wanikani/srs.rb#L24-L37 |
5,597 | ohler55/opee | lib/opee/queue.rb | Opee.Queue.add | def add(job)
if @workers.empty?
@work_queue.insert(0, job)
else
worker = @workers.pop()
ask_worker(worker, job)
end
end | ruby | def add(job)
if @workers.empty?
@work_queue.insert(0, job)
else
worker = @workers.pop()
ask_worker(worker, job)
end
end | [
"def",
"add",
"(",
"job",
")",
"if",
"@workers",
".",
"empty?",
"@work_queue",
".",
"insert",
"(",
"0",
",",
"job",
")",
"else",
"worker",
"=",
"@workers",
".",
"pop",
"(",
")",
"ask_worker",
"(",
"worker",
",",
"job",
")",
"end",
"end"
] | Places a job on the work queue. This method is executed asynchronously.
@param [Object] job work to be processed | [
"Places",
"a",
"job",
"on",
"the",
"work",
"queue",
".",
"This",
"method",
"is",
"executed",
"asynchronously",
"."
] | 09d947affeddc0501f61b928050fbde1838ed57a | https://github.com/ohler55/opee/blob/09d947affeddc0501f61b928050fbde1838ed57a/lib/opee/queue.rb#L78-L85 |
5,598 | ohler55/opee | lib/opee/queue.rb | Opee.Queue.ready | def ready(worker)
if @work_queue.empty?
@workers.insert(0, worker) unless @workers.include?(worker)
else
job = @work_queue.pop()
@add_thread.wakeup() unless @add_thread.nil?
ask_worker(worker, job)
end
end | ruby | def ready(worker)
if @work_queue.empty?
@workers.insert(0, worker) unless @workers.include?(worker)
else
job = @work_queue.pop()
@add_thread.wakeup() unless @add_thread.nil?
ask_worker(worker, job)
end
end | [
"def",
"ready",
"(",
"worker",
")",
"if",
"@work_queue",
".",
"empty?",
"@workers",
".",
"insert",
"(",
"0",
",",
"worker",
")",
"unless",
"@workers",
".",
"include?",
"(",
"worker",
")",
"else",
"job",
"=",
"@work_queue",
".",
"pop",
"(",
")",
"@add_t... | Identifies a worker as available to process jobs when they become
available. This method is executed asynchronously.
@param [Actor] worker Actor that responds to the method to be called | [
"Identifies",
"a",
"worker",
"as",
"available",
"to",
"process",
"jobs",
"when",
"they",
"become",
"available",
".",
"This",
"method",
"is",
"executed",
"asynchronously",
"."
] | 09d947affeddc0501f61b928050fbde1838ed57a | https://github.com/ohler55/opee/blob/09d947affeddc0501f61b928050fbde1838ed57a/lib/opee/queue.rb#L90-L98 |
5,599 | mLewisLogic/saddle | lib/saddle/requester.rb | Saddle.Requester.post | def post(url, data={}, options={})
response = connection.post do |req|
req.saddle_options = options
req.url(url)
req.body = data
end
handle_response(response)
end | ruby | def post(url, data={}, options={})
response = connection.post do |req|
req.saddle_options = options
req.url(url)
req.body = data
end
handle_response(response)
end | [
"def",
"post",
"(",
"url",
",",
"data",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
")",
"response",
"=",
"connection",
".",
"post",
"do",
"|",
"req",
"|",
"req",
".",
"saddle_options",
"=",
"options",
"req",
".",
"url",
"(",
"url",
")",
"req",... | Make a POST request | [
"Make",
"a",
"POST",
"request"
] | 9f470a948039dbedb75655d883e714a29b273961 | https://github.com/mLewisLogic/saddle/blob/9f470a948039dbedb75655d883e714a29b273961/lib/saddle/requester.rb#L91-L98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.