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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21,200 | amatsuda/rfd | lib/rfd/commands.rb | Rfd.Commands.ctrl_a | def ctrl_a
mark = marked_items.size != (items.size - 2) # exclude . and ..
items.each {|i| i.toggle_mark unless i.marked? == mark}
draw_items
draw_marked_items
move_cursor current_row
end | ruby | def ctrl_a
mark = marked_items.size != (items.size - 2) # exclude . and ..
items.each {|i| i.toggle_mark unless i.marked? == mark}
draw_items
draw_marked_items
move_cursor current_row
end | [
"def",
"ctrl_a",
"mark",
"=",
"marked_items",
".",
"size",
"!=",
"(",
"items",
".",
"size",
"-",
"2",
")",
"# exclude . and ..",
"items",
".",
"each",
"{",
"|",
"i",
"|",
"i",
".",
"toggle_mark",
"unless",
"i",
".",
"marked?",
"==",
"mark",
"}",
"dra... | Mark or unmark "a"ll files and directories. | [
"Mark",
"or",
"unmark",
"a",
"ll",
"files",
"and",
"directories",
"."
] | 403c0bc0ff0a9da1d21220b479d5a42008512b78 | https://github.com/amatsuda/rfd/blob/403c0bc0ff0a9da1d21220b479d5a42008512b78/lib/rfd/commands.rb#L190-L196 |
21,201 | amatsuda/rfd | lib/rfd/commands.rb | Rfd.Commands.enter | def enter
if current_item.name == '.' # do nothing
elsif current_item.name == '..'
cd '..'
elsif in_zip?
v
elsif current_item.directory? || current_item.zip?
cd current_item
else
v
end
end | ruby | def enter
if current_item.name == '.' # do nothing
elsif current_item.name == '..'
cd '..'
elsif in_zip?
v
elsif current_item.directory? || current_item.zip?
cd current_item
else
v
end
end | [
"def",
"enter",
"if",
"current_item",
".",
"name",
"==",
"'.'",
"# do nothing",
"elsif",
"current_item",
".",
"name",
"==",
"'..'",
"cd",
"'..'",
"elsif",
"in_zip?",
"v",
"elsif",
"current_item",
".",
"directory?",
"||",
"current_item",
".",
"zip?",
"cd",
"c... | cd into a directory, or view a file. | [
"cd",
"into",
"a",
"directory",
"or",
"view",
"a",
"file",
"."
] | 403c0bc0ff0a9da1d21220b479d5a42008512b78 | https://github.com/amatsuda/rfd/blob/403c0bc0ff0a9da1d21220b479d5a42008512b78/lib/rfd/commands.rb#L265-L276 |
21,202 | amatsuda/rfd | lib/rfd/commands.rb | Rfd.Commands.del | def del
if current_dir.path != '/'
dir_was = times == 1 ? current_dir.name : File.basename(current_dir.join(['..'] * (times - 1)))
cd File.expand_path(current_dir.join(['..'] * times))
find dir_was
end
end | ruby | def del
if current_dir.path != '/'
dir_was = times == 1 ? current_dir.name : File.basename(current_dir.join(['..'] * (times - 1)))
cd File.expand_path(current_dir.join(['..'] * times))
find dir_was
end
end | [
"def",
"del",
"if",
"current_dir",
".",
"path",
"!=",
"'/'",
"dir_was",
"=",
"times",
"==",
"1",
"?",
"current_dir",
".",
"name",
":",
"File",
".",
"basename",
"(",
"current_dir",
".",
"join",
"(",
"[",
"'..'",
"]",
"*",
"(",
"times",
"-",
"1",
")"... | cd to the upper hierarchy. | [
"cd",
"to",
"the",
"upper",
"hierarchy",
"."
] | 403c0bc0ff0a9da1d21220b479d5a42008512b78 | https://github.com/amatsuda/rfd/blob/403c0bc0ff0a9da1d21220b479d5a42008512b78/lib/rfd/commands.rb#L286-L292 |
21,203 | thumblemonks/riot | lib/riot/message.rb | Riot.Message.method_missing | def method_missing(meth, *phrases, &block)
push(meth.to_s.gsub('_', ' '))
_inspect(phrases)
end | ruby | def method_missing(meth, *phrases, &block)
push(meth.to_s.gsub('_', ' '))
_inspect(phrases)
end | [
"def",
"method_missing",
"(",
"meth",
",",
"*",
"phrases",
",",
"&",
"block",
")",
"push",
"(",
"meth",
".",
"to_s",
".",
"gsub",
"(",
"'_'",
",",
"' '",
")",
")",
"_inspect",
"(",
"phrases",
")",
"end"
] | Converts any method call into a more readable string by replacing underscores with spaces. Any
arguments to the method are inspected and appended to the final message. Blocks are currently ignored.
@param [String, Symbol] meth the method name to be converted into a more readable form
@param [Array<Object>] *phrases... | [
"Converts",
"any",
"method",
"call",
"into",
"a",
"more",
"readable",
"string",
"by",
"replacing",
"underscores",
"with",
"spaces",
".",
"Any",
"arguments",
"to",
"the",
"method",
"are",
"inspected",
"and",
"appended",
"to",
"the",
"final",
"message",
".",
"... | e99a8965f2d28730fc863c647ca40b3bffb9e562 | https://github.com/thumblemonks/riot/blob/e99a8965f2d28730fc863c647ca40b3bffb9e562/lib/riot/message.rb#L53-L56 |
21,204 | thumblemonks/riot | lib/riot/reporter.rb | Riot.Reporter.report | def report(description, response)
code, result = *response
case code
when :pass then
@passes += 1
pass(description, result)
when :fail then
@failures += 1
message, line, file = *response[1..-1]
fail(description, message, line, file)
when :error, :set... | ruby | def report(description, response)
code, result = *response
case code
when :pass then
@passes += 1
pass(description, result)
when :fail then
@failures += 1
message, line, file = *response[1..-1]
fail(description, message, line, file)
when :error, :set... | [
"def",
"report",
"(",
"description",
",",
"response",
")",
"code",
",",
"result",
"=",
"response",
"case",
"code",
"when",
":pass",
"then",
"@passes",
"+=",
"1",
"pass",
"(",
"description",
",",
"result",
")",
"when",
":fail",
"then",
"@failures",
"+=",
... | Called immediately after an assertion has been evaluated. From this method either +pass+, +fail+,
or +error+ will be called.
@param [String] description the description of the assertion
@param [Array<Symbol, *[Object]>] response the evaluation response from the assertion | [
"Called",
"immediately",
"after",
"an",
"assertion",
"has",
"been",
"evaluated",
".",
"From",
"this",
"method",
"either",
"+",
"pass",
"+",
"+",
"fail",
"+",
"or",
"+",
"error",
"+",
"will",
"be",
"called",
"."
] | e99a8965f2d28730fc863c647ca40b3bffb9e562 | https://github.com/thumblemonks/riot/blob/e99a8965f2d28730fc863c647ca40b3bffb9e562/lib/riot/reporter.rb#L63-L77 |
21,205 | singlebrook/utf8-cleaner | lib/utf8-cleaner/uri_string.rb | UTF8Cleaner.URIString.encoded_char_array | def encoded_char_array
char_array = []
index = 0
while (index < data.length) do
char = data[index]
if char == '%'
# Skip the next two characters, which are the encoded byte
# indicates by this %. (We'll change this later for multibyte characters.)
skip_n... | ruby | def encoded_char_array
char_array = []
index = 0
while (index < data.length) do
char = data[index]
if char == '%'
# Skip the next two characters, which are the encoded byte
# indicates by this %. (We'll change this later for multibyte characters.)
skip_n... | [
"def",
"encoded_char_array",
"char_array",
"=",
"[",
"]",
"index",
"=",
"0",
"while",
"(",
"index",
"<",
"data",
".",
"length",
")",
"do",
"char",
"=",
"data",
"[",
"index",
"]",
"if",
"char",
"==",
"'%'",
"# Skip the next two characters, which are the encoded... | Returns an array of valid URI-encoded UTF-8 characters. | [
"Returns",
"an",
"array",
"of",
"valid",
"URI",
"-",
"encoded",
"UTF",
"-",
"8",
"characters",
"."
] | adc8db208ed8a390240a087cce3cdabda2d1afa3 | https://github.com/singlebrook/utf8-cleaner/blob/adc8db208ed8a390240a087cce3cdabda2d1afa3/lib/utf8-cleaner/uri_string.rb#L31-L87 |
21,206 | singlebrook/utf8-cleaner | lib/utf8-cleaner/uri_string.rb | UTF8Cleaner.URIString.utf8_char_length_in_bytes | def utf8_char_length_in_bytes(first_byte)
if first_byte.hex < 'C0'.hex
1
elsif first_byte.hex < 'DF'.hex
2
elsif first_byte.hex < 'EF'.hex
3
else
4
end
end | ruby | def utf8_char_length_in_bytes(first_byte)
if first_byte.hex < 'C0'.hex
1
elsif first_byte.hex < 'DF'.hex
2
elsif first_byte.hex < 'EF'.hex
3
else
4
end
end | [
"def",
"utf8_char_length_in_bytes",
"(",
"first_byte",
")",
"if",
"first_byte",
".",
"hex",
"<",
"'C0'",
".",
"hex",
"1",
"elsif",
"first_byte",
".",
"hex",
"<",
"'DF'",
".",
"hex",
"2",
"elsif",
"first_byte",
".",
"hex",
"<",
"'EF'",
".",
"hex",
"3",
... | If the first byte is between 0xC0 and 0xDF, the UTF-8 character has two bytes;
if it is between 0xE0 and 0xEF, the UTF-8 character has 3 bytes;
and if it is 0xF0 and 0xFF, the UTF-8 character has 4 bytes.
first_byte is a string like "0x13" | [
"If",
"the",
"first",
"byte",
"is",
"between",
"0xC0",
"and",
"0xDF",
"the",
"UTF",
"-",
"8",
"character",
"has",
"two",
"bytes",
";",
"if",
"it",
"is",
"between",
"0xE0",
"and",
"0xEF",
"the",
"UTF",
"-",
"8",
"character",
"has",
"3",
"bytes",
";",
... | adc8db208ed8a390240a087cce3cdabda2d1afa3 | https://github.com/singlebrook/utf8-cleaner/blob/adc8db208ed8a390240a087cce3cdabda2d1afa3/lib/utf8-cleaner/uri_string.rb#L121-L131 |
21,207 | rlister/stax | lib/stax/mixin/ecs.rb | Stax.Ecs.ecs_services_with_ids | def ecs_services_with_ids(*ids)
if ids.empty?
ecs_services
else
ecs_services.select do |s|
ids.include?(s.logical_resource_id)
end
end
end | ruby | def ecs_services_with_ids(*ids)
if ids.empty?
ecs_services
else
ecs_services.select do |s|
ids.include?(s.logical_resource_id)
end
end
end | [
"def",
"ecs_services_with_ids",
"(",
"*",
"ids",
")",
"if",
"ids",
".",
"empty?",
"ecs_services",
"else",
"ecs_services",
".",
"select",
"do",
"|",
"s",
"|",
"ids",
".",
"include?",
"(",
"s",
".",
"logical_resource_id",
")",
"end",
"end",
"end"
] | get services with a list of logical ids | [
"get",
"services",
"with",
"a",
"list",
"of",
"logical",
"ids"
] | 450b4431627a6751f911410f996e6f24cd814272 | https://github.com/rlister/stax/blob/450b4431627a6751f911410f996e6f24cd814272/lib/stax/mixin/ecs.rb#L28-L36 |
21,208 | maestrano/maestrano-connector-rails | app/jobs/maestrano/connector/rails/all_synchronizations_job.rb | Maestrano::Connector::Rails.AllSynchronizationsJob.perform | def perform(name = nil, count = nil)
Maestrano::Connector::Rails::Organization
.where.not(oauth_provider: nil, encrypted_oauth_token: nil)
.where(sync_enabled: true)
.select(:id)
.find_each do |organization|
Maestrano::Connector::Rails::SynchronizationJob.set(wait: rand(360... | ruby | def perform(name = nil, count = nil)
Maestrano::Connector::Rails::Organization
.where.not(oauth_provider: nil, encrypted_oauth_token: nil)
.where(sync_enabled: true)
.select(:id)
.find_each do |organization|
Maestrano::Connector::Rails::SynchronizationJob.set(wait: rand(360... | [
"def",
"perform",
"(",
"name",
"=",
"nil",
",",
"count",
"=",
"nil",
")",
"Maestrano",
"::",
"Connector",
"::",
"Rails",
"::",
"Organization",
".",
"where",
".",
"not",
"(",
"oauth_provider",
":",
"nil",
",",
"encrypted_oauth_token",
":",
"nil",
")",
"."... | Trigger synchronization of all active organizations | [
"Trigger",
"synchronization",
"of",
"all",
"active",
"organizations"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/jobs/maestrano/connector/rails/all_synchronizations_job.rb#L6-L14 |
21,209 | aasmith/feed-normalizer | lib/structures.rb | FeedNormalizer.ElementCleaner.clean! | def clean!
self.class::SIMPLE_ELEMENTS.each do |element|
val = self.send(element)
send("#{element}=", (val.is_a?(Array) ?
val.collect{|v| HtmlCleaner.flatten(v.to_s)} : HtmlCleaner.flatten(val.to_s)))
end
self.class::HTML_ELEMENTS.each do |element|
send("#{element}=... | ruby | def clean!
self.class::SIMPLE_ELEMENTS.each do |element|
val = self.send(element)
send("#{element}=", (val.is_a?(Array) ?
val.collect{|v| HtmlCleaner.flatten(v.to_s)} : HtmlCleaner.flatten(val.to_s)))
end
self.class::HTML_ELEMENTS.each do |element|
send("#{element}=... | [
"def",
"clean!",
"self",
".",
"class",
"::",
"SIMPLE_ELEMENTS",
".",
"each",
"do",
"|",
"element",
"|",
"val",
"=",
"self",
".",
"send",
"(",
"element",
")",
"send",
"(",
"\"#{element}=\"",
",",
"(",
"val",
".",
"is_a?",
"(",
"Array",
")",
"?",
"val"... | Recursively cleans all elements in place.
Only allow tags in whitelist. Always parse the html with a parser and delete
all tags that arent on the list.
For feed elements that can contain HTML:
- feed.(title|description)
- feed.entries[n].(title|description|content) | [
"Recursively",
"cleans",
"all",
"elements",
"in",
"place",
"."
] | afa7765c08481d38729a71bd5dfd5ef95736f026 | https://github.com/aasmith/feed-normalizer/blob/afa7765c08481d38729a71bd5dfd5ef95736f026/lib/structures.rb#L102-L117 |
21,210 | rlister/stax | lib/stax/mixin/ssm.rb | Stax.Ssm.ssm_parameter_tmpfile | def ssm_parameter_tmpfile(name)
Tempfile.new(stack_name).tap do |file|
file.write(ssm_parameter_get(name))
File.chmod(0400, file.path)
file.close
end
end | ruby | def ssm_parameter_tmpfile(name)
Tempfile.new(stack_name).tap do |file|
file.write(ssm_parameter_get(name))
File.chmod(0400, file.path)
file.close
end
end | [
"def",
"ssm_parameter_tmpfile",
"(",
"name",
")",
"Tempfile",
".",
"new",
"(",
"stack_name",
")",
".",
"tap",
"do",
"|",
"file",
"|",
"file",
".",
"write",
"(",
"ssm_parameter_get",
"(",
"name",
")",
")",
"File",
".",
"chmod",
"(",
"0400",
",",
"file",... | get a parameter from the store to a Tmpfile | [
"get",
"a",
"parameter",
"from",
"the",
"store",
"to",
"a",
"Tmpfile"
] | 450b4431627a6751f911410f996e6f24cd814272 | https://github.com/rlister/stax/blob/450b4431627a6751f911410f996e6f24cd814272/lib/stax/mixin/ssm.rb#L37-L43 |
21,211 | rlister/stax | lib/stax/mixin/ssm.rb | Stax.Ssm.ssm_run_shellscript | def ssm_run_shellscript(*cmd)
Aws::Ssm.run(
document_name: 'AWS-RunShellScript',
targets: [{key: 'tag:aws:cloudformation:stack-name', values: [stack_name]}],
parameters: {commands: cmd}
)&.command_id.tap(&method(:puts))
end | ruby | def ssm_run_shellscript(*cmd)
Aws::Ssm.run(
document_name: 'AWS-RunShellScript',
targets: [{key: 'tag:aws:cloudformation:stack-name', values: [stack_name]}],
parameters: {commands: cmd}
)&.command_id.tap(&method(:puts))
end | [
"def",
"ssm_run_shellscript",
"(",
"*",
"cmd",
")",
"Aws",
"::",
"Ssm",
".",
"run",
"(",
"document_name",
":",
"'AWS-RunShellScript'",
",",
"targets",
":",
"[",
"{",
"key",
":",
"'tag:aws:cloudformation:stack-name'",
",",
"values",
":",
"[",
"stack_name",
"]",... | run a command on stack instances | [
"run",
"a",
"command",
"on",
"stack",
"instances"
] | 450b4431627a6751f911410f996e6f24cd814272 | https://github.com/rlister/stax/blob/450b4431627a6751f911410f996e6f24cd814272/lib/stax/mixin/ssm.rb#L50-L56 |
21,212 | kddeisz/snip_snip | lib/snip_snip/reporter.rb | SnipSnip.Reporter.report | def report(controller)
return if results.empty?
action_display = "#{controller.controller_name}##{controller.action_name}"
SnipSnip.logger.info(action_display)
results.sort_by(&:report).each do |result|
SnipSnip.logger.info(" #{result.report}")
end
ensure
Registry.clea... | ruby | def report(controller)
return if results.empty?
action_display = "#{controller.controller_name}##{controller.action_name}"
SnipSnip.logger.info(action_display)
results.sort_by(&:report).each do |result|
SnipSnip.logger.info(" #{result.report}")
end
ensure
Registry.clea... | [
"def",
"report",
"(",
"controller",
")",
"return",
"if",
"results",
".",
"empty?",
"action_display",
"=",
"\"#{controller.controller_name}##{controller.action_name}\"",
"SnipSnip",
".",
"logger",
".",
"info",
"(",
"action_display",
")",
"results",
".",
"sort_by",
"(",... | Report on the unused columns that were selected during the course of the
processing the action on the given controller. | [
"Report",
"on",
"the",
"unused",
"columns",
"that",
"were",
"selected",
"during",
"the",
"course",
"of",
"the",
"processing",
"the",
"action",
"on",
"the",
"given",
"controller",
"."
] | 432879a18560d2ea3bf158293d92b386da095a80 | https://github.com/kddeisz/snip_snip/blob/432879a18560d2ea3bf158293d92b386da095a80/lib/snip_snip/reporter.rb#L23-L34 |
21,213 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.fold_references | def fold_references(mapped_external_entity, references, organization)
references = format_references(references)
mapped_external_entity = mapped_external_entity.with_indifferent_access
# Use both record_references and id_references + the id
(references.values.flatten + ['id']).each do |referenc... | ruby | def fold_references(mapped_external_entity, references, organization)
references = format_references(references)
mapped_external_entity = mapped_external_entity.with_indifferent_access
# Use both record_references and id_references + the id
(references.values.flatten + ['id']).each do |referenc... | [
"def",
"fold_references",
"(",
"mapped_external_entity",
",",
"references",
",",
"organization",
")",
"references",
"=",
"format_references",
"(",
"references",
")",
"mapped_external_entity",
"=",
"mapped_external_entity",
".",
"with_indifferent_access",
"# Use both record_re... | Replaces ids from the external application by arrays containing them | [
"Replaces",
"ids",
"from",
"the",
"external",
"application",
"by",
"arrays",
"containing",
"them"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L73-L83 |
21,214 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.id_hash | def id_hash(id, organization)
{
id: id,
provider: organization.oauth_provider,
realm: organization.oauth_uid
}
end | ruby | def id_hash(id, organization)
{
id: id,
provider: organization.oauth_provider,
realm: organization.oauth_uid
}
end | [
"def",
"id_hash",
"(",
"id",
",",
"organization",
")",
"{",
"id",
":",
"id",
",",
"provider",
":",
"organization",
".",
"oauth_provider",
",",
"realm",
":",
"organization",
".",
"oauth_uid",
"}",
"end"
] | Builds an id_hash from the id and organization | [
"Builds",
"an",
"id_hash",
"from",
"the",
"id",
"and",
"organization"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L86-L92 |
21,215 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.fold_references_helper | def fold_references_helper(entity, array_of_refs, organization)
ref = array_of_refs.shift
field = entity[ref]
return if field.blank?
# Follow embedment path, remplace if it's not an array or a hash
case field
when Array
field.each do |f|
fold_references_helper(f, a... | ruby | def fold_references_helper(entity, array_of_refs, organization)
ref = array_of_refs.shift
field = entity[ref]
return if field.blank?
# Follow embedment path, remplace if it's not an array or a hash
case field
when Array
field.each do |f|
fold_references_helper(f, a... | [
"def",
"fold_references_helper",
"(",
"entity",
",",
"array_of_refs",
",",
"organization",
")",
"ref",
"=",
"array_of_refs",
".",
"shift",
"field",
"=",
"entity",
"[",
"ref",
"]",
"return",
"if",
"field",
".",
"blank?",
"# Follow embedment path, remplace if it's not... | Recursive method for folding references | [
"Recursive",
"method",
"for",
"folding",
"references"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L95-L112 |
21,216 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.unfold_references_helper | def unfold_references_helper(entity, array_of_refs, organization)
ref = array_of_refs.shift
field = entity[ref]
# Unfold the id
if array_of_refs.empty? && field
return entity.delete(ref) if field.is_a?(String) # ~retro-compatibility to ease transition aroud Connec! idmaps rework. Should... | ruby | def unfold_references_helper(entity, array_of_refs, organization)
ref = array_of_refs.shift
field = entity[ref]
# Unfold the id
if array_of_refs.empty? && field
return entity.delete(ref) if field.is_a?(String) # ~retro-compatibility to ease transition aroud Connec! idmaps rework. Should... | [
"def",
"unfold_references_helper",
"(",
"entity",
",",
"array_of_refs",
",",
"organization",
")",
"ref",
"=",
"array_of_refs",
".",
"shift",
"field",
"=",
"entity",
"[",
"ref",
"]",
"# Unfold the id",
"if",
"array_of_refs",
".",
"empty?",
"&&",
"field",
"return"... | Recursive method for unfolding references | [
"Recursive",
"method",
"for",
"unfolding",
"references"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L115-L150 |
21,217 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.filter_connec_entity_for_id_refs | def filter_connec_entity_for_id_refs(connec_entity, id_references)
return {} if id_references.empty?
entity = connec_entity.dup.with_indifferent_access
tree = build_id_references_tree(id_references)
filter_connec_entity_for_id_refs_helper(entity, tree)
# TODO, improve performance by ret... | ruby | def filter_connec_entity_for_id_refs(connec_entity, id_references)
return {} if id_references.empty?
entity = connec_entity.dup.with_indifferent_access
tree = build_id_references_tree(id_references)
filter_connec_entity_for_id_refs_helper(entity, tree)
# TODO, improve performance by ret... | [
"def",
"filter_connec_entity_for_id_refs",
"(",
"connec_entity",
",",
"id_references",
")",
"return",
"{",
"}",
"if",
"id_references",
".",
"empty?",
"entity",
"=",
"connec_entity",
".",
"dup",
".",
"with_indifferent_access",
"tree",
"=",
"build_id_references_tree",
"... | Returns the connec_entity without all the fields that are not id_references | [
"Returns",
"the",
"connec_entity",
"without",
"all",
"the",
"fields",
"that",
"are",
"not",
"id_references"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L163-L174 |
21,218 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.filter_connec_entity_for_id_refs_helper | def filter_connec_entity_for_id_refs_helper(entity_hash, tree)
return if tree.empty?
entity_hash.slice!(*tree.keys)
tree.each do |key, children|
case entity_hash[key]
when Array
entity_hash[key].each do |hash|
filter_connec_entity_for_id_refs_helper(hash, childr... | ruby | def filter_connec_entity_for_id_refs_helper(entity_hash, tree)
return if tree.empty?
entity_hash.slice!(*tree.keys)
tree.each do |key, children|
case entity_hash[key]
when Array
entity_hash[key].each do |hash|
filter_connec_entity_for_id_refs_helper(hash, childr... | [
"def",
"filter_connec_entity_for_id_refs_helper",
"(",
"entity_hash",
",",
"tree",
")",
"return",
"if",
"tree",
".",
"empty?",
"entity_hash",
".",
"slice!",
"(",
"tree",
".",
"keys",
")",
"tree",
".",
"each",
"do",
"|",
"key",
",",
"children",
"|",
"case",
... | Recursive method for filtering connec entities | [
"Recursive",
"method",
"for",
"filtering",
"connec",
"entities"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L177-L192 |
21,219 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.merge_id_hashes | def merge_id_hashes(dist, src, id_references)
dist = dist.with_indifferent_access
src = src.with_indifferent_access
id_references.each do |id_reference|
array_of_refs = id_reference.split('/')
merge_id_hashes_helper(dist, array_of_refs, src)
end
dist
end | ruby | def merge_id_hashes(dist, src, id_references)
dist = dist.with_indifferent_access
src = src.with_indifferent_access
id_references.each do |id_reference|
array_of_refs = id_reference.split('/')
merge_id_hashes_helper(dist, array_of_refs, src)
end
dist
end | [
"def",
"merge_id_hashes",
"(",
"dist",
",",
"src",
",",
"id_references",
")",
"dist",
"=",
"dist",
".",
"with_indifferent_access",
"src",
"=",
"src",
".",
"with_indifferent_access",
"id_references",
".",
"each",
"do",
"|",
"id_reference",
"|",
"array_of_refs",
"... | Merges the id arrays from two hashes while keeping only the id_references fields | [
"Merges",
"the",
"id",
"arrays",
"from",
"two",
"hashes",
"while",
"keeping",
"only",
"the",
"id_references",
"fields"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L214-L225 |
21,220 | maestrano/maestrano-connector-rails | app/models/maestrano/connector/rails/concerns/connec_helper.rb | Maestrano::Connector::Rails::Concerns::ConnecHelper.ClassMethods.merge_id_hashes_helper | def merge_id_hashes_helper(hash, array_of_refs, src, path = [])
ref = array_of_refs.shift
field = hash[ref]
if array_of_refs.empty? && field
value = value_from_hash(src, path + [ref])
if value.is_a?(Array)
hash[ref] = (field + value).uniq
else
hash.delete(r... | ruby | def merge_id_hashes_helper(hash, array_of_refs, src, path = [])
ref = array_of_refs.shift
field = hash[ref]
if array_of_refs.empty? && field
value = value_from_hash(src, path + [ref])
if value.is_a?(Array)
hash[ref] = (field + value).uniq
else
hash.delete(r... | [
"def",
"merge_id_hashes_helper",
"(",
"hash",
",",
"array_of_refs",
",",
"src",
",",
"path",
"=",
"[",
"]",
")",
"ref",
"=",
"array_of_refs",
".",
"shift",
"field",
"=",
"hash",
"[",
"ref",
"]",
"if",
"array_of_refs",
".",
"empty?",
"&&",
"field",
"value... | Recursive helper for merging id hashes | [
"Recursive",
"helper",
"for",
"merging",
"id",
"hashes"
] | c7f0e9591c1065f1ee0eca318869757da7c3bc04 | https://github.com/maestrano/maestrano-connector-rails/blob/c7f0e9591c1065f1ee0eca318869757da7c3bc04/app/models/maestrano/connector/rails/concerns/connec_helper.rb#L228-L249 |
21,221 | rlister/stax | lib/stax/mixin/ecs/deploy.rb | Stax.Ecs.taskdef_to_hash | def taskdef_to_hash(taskdef)
args = %i[family cpu memory requires_compatibilities task_role_arn execution_role_arn network_mode container_definitions volumes placement_constraints]
taskdef.to_hash.slice(*args)
end | ruby | def taskdef_to_hash(taskdef)
args = %i[family cpu memory requires_compatibilities task_role_arn execution_role_arn network_mode container_definitions volumes placement_constraints]
taskdef.to_hash.slice(*args)
end | [
"def",
"taskdef_to_hash",
"(",
"taskdef",
")",
"args",
"=",
"%i[",
"family",
"cpu",
"memory",
"requires_compatibilities",
"task_role_arn",
"execution_role_arn",
"network_mode",
"container_definitions",
"volumes",
"placement_constraints",
"]",
"taskdef",
".",
"to_hash",
".... | convert to hash for registering new taskdef | [
"convert",
"to",
"hash",
"for",
"registering",
"new",
"taskdef"
] | 450b4431627a6751f911410f996e6f24cd814272 | https://github.com/rlister/stax/blob/450b4431627a6751f911410f996e6f24cd814272/lib/stax/mixin/ecs/deploy.rb#L5-L8 |
21,222 | rlister/stax | lib/stax/mixin/ecs/deploy.rb | Stax.Ecs.ecs_deploy | def ecs_deploy(id, &block)
service = Aws::Ecs.services(ecs_cluster_name, [resource(id)]).first
taskdef = get_taskdef(service)
## convert to a hash and modify in block
hash = taskdef_to_hash(taskdef)
yield(hash) if block_given?
taskdef = register_taskdef(hash)
update_service(s... | ruby | def ecs_deploy(id, &block)
service = Aws::Ecs.services(ecs_cluster_name, [resource(id)]).first
taskdef = get_taskdef(service)
## convert to a hash and modify in block
hash = taskdef_to_hash(taskdef)
yield(hash) if block_given?
taskdef = register_taskdef(hash)
update_service(s... | [
"def",
"ecs_deploy",
"(",
"id",
",",
"&",
"block",
")",
"service",
"=",
"Aws",
"::",
"Ecs",
".",
"services",
"(",
"ecs_cluster_name",
",",
"[",
"resource",
"(",
"id",
")",
"]",
")",
".",
"first",
"taskdef",
"=",
"get_taskdef",
"(",
"service",
")",
"#... | update taskdef for a service, triggering a deploy
modify current taskdef in block | [
"update",
"taskdef",
"for",
"a",
"service",
"triggering",
"a",
"deploy",
"modify",
"current",
"taskdef",
"in",
"block"
] | 450b4431627a6751f911410f996e6f24cd814272 | https://github.com/rlister/stax/blob/450b4431627a6751f911410f996e6f24cd814272/lib/stax/mixin/ecs/deploy.rb#L36-L46 |
21,223 | avdgaag/rpub | lib/rpub/compressor.rb | Rpub.Compressor.store_file | def store_file(filename, content)
zip.put_next_entry filename, nil, nil, Zip::Entry::STORED, Zlib::NO_COMPRESSION
zip.write content.to_s
end | ruby | def store_file(filename, content)
zip.put_next_entry filename, nil, nil, Zip::Entry::STORED, Zlib::NO_COMPRESSION
zip.write content.to_s
end | [
"def",
"store_file",
"(",
"filename",
",",
"content",
")",
"zip",
".",
"put_next_entry",
"filename",
",",
"nil",
",",
"nil",
",",
"Zip",
"::",
"Entry",
"::",
"STORED",
",",
"Zlib",
"::",
"NO_COMPRESSION",
"zip",
".",
"write",
"content",
".",
"to_s",
"end... | Store a file in the archive without any compression.
@param [String] filename under the which the data should be stored
@param [#to_s] content to be compressed | [
"Store",
"a",
"file",
"in",
"the",
"archive",
"without",
"any",
"compression",
"."
] | 9ab682ea5a20e3e6c1d6ce16c71149db0476f6c2 | https://github.com/avdgaag/rpub/blob/9ab682ea5a20e3e6c1d6ce16c71149db0476f6c2/lib/rpub/compressor.rb#L32-L35 |
21,224 | avdgaag/rpub | lib/rpub/compressor.rb | Rpub.Compressor.compress_file | def compress_file(filename, content)
zip.put_next_entry filename, nil, nil, Zip::Entry::DEFLATED, Zlib::BEST_COMPRESSION
zip.write content.to_s
end | ruby | def compress_file(filename, content)
zip.put_next_entry filename, nil, nil, Zip::Entry::DEFLATED, Zlib::BEST_COMPRESSION
zip.write content.to_s
end | [
"def",
"compress_file",
"(",
"filename",
",",
"content",
")",
"zip",
".",
"put_next_entry",
"filename",
",",
"nil",
",",
"nil",
",",
"Zip",
"::",
"Entry",
"::",
"DEFLATED",
",",
"Zlib",
"::",
"BEST_COMPRESSION",
"zip",
".",
"write",
"content",
".",
"to_s",... | Store a file with maximum compression in the archive.
@param [String] filename under the which the data should be stored
@param [#to_s] content to be compressed | [
"Store",
"a",
"file",
"with",
"maximum",
"compression",
"in",
"the",
"archive",
"."
] | 9ab682ea5a20e3e6c1d6ce16c71149db0476f6c2 | https://github.com/avdgaag/rpub/blob/9ab682ea5a20e3e6c1d6ce16c71149db0476f6c2/lib/rpub/compressor.rb#L41-L44 |
21,225 | afair/postgresql_cursor | lib/postgresql_cursor/cursor.rb | PostgreSQLCursor.Cursor.pluck | def pluck(*cols)
options = cols.last.is_a?(Hash) ? cols.pop : {}
@options.merge!(options)
@options[:symbolize_keys] = true
self.iterate_type(options[:class]) if options[:class]
cols = cols.map {|c| c.to_sym }
result = []
self.each() do |row|
row = row.symbolize_key... | ruby | def pluck(*cols)
options = cols.last.is_a?(Hash) ? cols.pop : {}
@options.merge!(options)
@options[:symbolize_keys] = true
self.iterate_type(options[:class]) if options[:class]
cols = cols.map {|c| c.to_sym }
result = []
self.each() do |row|
row = row.symbolize_key... | [
"def",
"pluck",
"(",
"*",
"cols",
")",
"options",
"=",
"cols",
".",
"last",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"cols",
".",
"pop",
":",
"{",
"}",
"@options",
".",
"merge!",
"(",
"options",
")",
"@options",
"[",
":symbolize_keys",
"]",
"=",
"true"... | Returns an array of columns plucked from the result rows.
Experimental function, as this could still use too much memory
and negate the purpose of this libarary.
Should this return a lazy enumerator instead? | [
"Returns",
"an",
"array",
"of",
"columns",
"plucked",
"from",
"the",
"result",
"rows",
".",
"Experimental",
"function",
"as",
"this",
"could",
"still",
"use",
"too",
"much",
"memory",
"and",
"negate",
"the",
"purpose",
"of",
"this",
"libarary",
".",
"Should"... | 92224ba8e33df8da85b9c31ffdb56feb29390887 | https://github.com/afair/postgresql_cursor/blob/92224ba8e33df8da85b9c31ffdb56feb29390887/lib/postgresql_cursor/cursor.rb#L165-L180 |
21,226 | cantino/reckon | lib/reckon/app.rb | Reckon.App.weighted_account_match | def weighted_account_match( row )
query_tokens = tokenize(row[:description])
search_vector = []
account_vectors = {}
query_tokens.each do |token|
idf = Math.log((accounts.keys.length + 1) / ((tokens[token] || {}).keys.length.to_f + 1))
tf = 1.0 / query_tokens.length.to_f
... | ruby | def weighted_account_match( row )
query_tokens = tokenize(row[:description])
search_vector = []
account_vectors = {}
query_tokens.each do |token|
idf = Math.log((accounts.keys.length + 1) / ((tokens[token] || {}).keys.length.to_f + 1))
tf = 1.0 / query_tokens.length.to_f
... | [
"def",
"weighted_account_match",
"(",
"row",
")",
"query_tokens",
"=",
"tokenize",
"(",
"row",
"[",
":description",
"]",
")",
"search_vector",
"=",
"[",
"]",
"account_vectors",
"=",
"{",
"}",
"query_tokens",
".",
"each",
"do",
"|",
"token",
"|",
"idf",
"="... | Weigh accounts by how well they match the row | [
"Weigh",
"accounts",
"by",
"how",
"well",
"they",
"match",
"the",
"row"
] | 781a80f3fa213656d19909e3f42d0e469e5d8d47 | https://github.com/cantino/reckon/blob/781a80f3fa213656d19909e3f42d0e469e5d8d47/lib/reckon/app.rb#L180-L214 |
21,227 | Kesin11/danger-textlint | lib/textlint/plugin.rb | Danger.DangerTextlint.lint | def lint
return if target_files.empty?
bin = textlint_path
result_json = run_textlint(bin, target_files)
errors = parse(result_json)
send_comment(errors)
end | ruby | def lint
return if target_files.empty?
bin = textlint_path
result_json = run_textlint(bin, target_files)
errors = parse(result_json)
send_comment(errors)
end | [
"def",
"lint",
"return",
"if",
"target_files",
".",
"empty?",
"bin",
"=",
"textlint_path",
"result_json",
"=",
"run_textlint",
"(",
"bin",
",",
"target_files",
")",
"errors",
"=",
"parse",
"(",
"result_json",
")",
"send_comment",
"(",
"errors",
")",
"end"
] | Execute textlint and send comment
@return [void] | [
"Execute",
"textlint",
"and",
"send",
"comment"
] | bdc5826c0726ccc418034d30d3184f824f2d4035 | https://github.com/Kesin11/danger-textlint/blob/bdc5826c0726ccc418034d30d3184f824f2d4035/lib/textlint/plugin.rb#L42-L49 |
21,228 | karafka/capistrano-karafka | lib/capistrano/karafka.rb | Capistrano.Karafka.set_defaults | def set_defaults
set_if_empty :karafka_role, :karafka
set_if_empty :karafka_processes, 1
set_if_empty :karafka_consumer_groups, []
set_if_empty :karafka_default_hooks, -> { true }
set_if_empty :karafka_env, -> { fetch(:karafka_env, fetch(:environment)) }
set_if_empty :karafka_pid, ->... | ruby | def set_defaults
set_if_empty :karafka_role, :karafka
set_if_empty :karafka_processes, 1
set_if_empty :karafka_consumer_groups, []
set_if_empty :karafka_default_hooks, -> { true }
set_if_empty :karafka_env, -> { fetch(:karafka_env, fetch(:environment)) }
set_if_empty :karafka_pid, ->... | [
"def",
"set_defaults",
"set_if_empty",
":karafka_role",
",",
":karafka",
"set_if_empty",
":karafka_processes",
",",
"1",
"set_if_empty",
":karafka_consumer_groups",
",",
"[",
"]",
"set_if_empty",
":karafka_default_hooks",
",",
"->",
"{",
"true",
"}",
"set_if_empty",
":k... | Default values for Karafka settings | [
"Default",
"values",
"for",
"Karafka",
"settings"
] | 984e07d5ab6d3de9a434b539c1cd92b34bbdd999 | https://github.com/karafka/capistrano-karafka/blob/984e07d5ab6d3de9a434b539c1cd92b34bbdd999/lib/capistrano/karafka.rb#L20-L27 |
21,229 | mwunsch/weary | lib/weary/resource.rb | Weary.Resource.meets_requirements? | def meets_requirements?(params)
requirements.reject {|k| params.keys.map(&:to_s).include? k.to_s }.empty?
end | ruby | def meets_requirements?(params)
requirements.reject {|k| params.keys.map(&:to_s).include? k.to_s }.empty?
end | [
"def",
"meets_requirements?",
"(",
"params",
")",
"requirements",
".",
"reject",
"{",
"|",
"k",
"|",
"params",
".",
"keys",
".",
"map",
"(",
":to_s",
")",
".",
"include?",
"k",
".",
"to_s",
"}",
".",
"empty?",
"end"
] | Given a hash of Request parameters, do they meet the requirements? | [
"Given",
"a",
"hash",
"of",
"Request",
"parameters",
"do",
"they",
"meet",
"the",
"requirements?"
] | e36ce4f82d83cbc3d826eaa427acc5e66a0f849b | https://github.com/mwunsch/weary/blob/e36ce4f82d83cbc3d826eaa427acc5e66a0f849b/lib/weary/resource.rb#L97-L99 |
21,230 | mwunsch/weary | lib/weary/resource.rb | Weary.Resource.request | def request(params={})
normalize_parameters params
raise UnmetRequirementsError, "Required parameters: #{requirements}" \
unless meets_requirements? params
credentials = pull_credentials params
pairs = pull_url_pairs params
request = construct_request expand_url(pairs), params, cre... | ruby | def request(params={})
normalize_parameters params
raise UnmetRequirementsError, "Required parameters: #{requirements}" \
unless meets_requirements? params
credentials = pull_credentials params
pairs = pull_url_pairs params
request = construct_request expand_url(pairs), params, cre... | [
"def",
"request",
"(",
"params",
"=",
"{",
"}",
")",
"normalize_parameters",
"params",
"raise",
"UnmetRequirementsError",
",",
"\"Required parameters: #{requirements}\"",
"unless",
"meets_requirements?",
"params",
"credentials",
"=",
"pull_credentials",
"params",
"pairs",
... | Construct the request from the given parameters.
Yields the Request
Returns the Request.
Raises a Weary::Resource::UnmetRequirementsError if the requirements
are not met. | [
"Construct",
"the",
"request",
"from",
"the",
"given",
"parameters",
"."
] | e36ce4f82d83cbc3d826eaa427acc5e66a0f849b | https://github.com/mwunsch/weary/blob/e36ce4f82d83cbc3d826eaa427acc5e66a0f849b/lib/weary/resource.rb#L108-L117 |
21,231 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.compute_origin | def compute_origin
return nil if move.castle
possibilities = case move.piece
when /[brq]/i then direction_origins
when /[kn]/i then move_origins
when /p/i then pawn_origins
end
if possibilities.length > 1
possibilities = disambiguate(possibilities)
end
... | ruby | def compute_origin
return nil if move.castle
possibilities = case move.piece
when /[brq]/i then direction_origins
when /[kn]/i then move_origins
when /p/i then pawn_origins
end
if possibilities.length > 1
possibilities = disambiguate(possibilities)
end
... | [
"def",
"compute_origin",
"return",
"nil",
"if",
"move",
".",
"castle",
"possibilities",
"=",
"case",
"move",
".",
"piece",
"when",
"/",
"/i",
"then",
"direction_origins",
"when",
"/",
"/i",
"then",
"move_origins",
"when",
"/",
"/i",
"then",
"pawn_origins",
"... | Using the current position and move, figure out where the piece
came from. | [
"Using",
"the",
"current",
"position",
"and",
"move",
"figure",
"out",
"where",
"the",
"piece",
"came",
"from",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L181-L195 |
21,232 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.direction_origins | def direction_origins
directions = DIRECTIONS[move.piece.downcase]
possibilities = []
directions.each do |dir|
piece, square = first_piece(destination_coords, dir)
possibilities << square if piece == self.move.piece
end
possibilities
end | ruby | def direction_origins
directions = DIRECTIONS[move.piece.downcase]
possibilities = []
directions.each do |dir|
piece, square = first_piece(destination_coords, dir)
possibilities << square if piece == self.move.piece
end
possibilities
end | [
"def",
"direction_origins",
"directions",
"=",
"DIRECTIONS",
"[",
"move",
".",
"piece",
".",
"downcase",
"]",
"possibilities",
"=",
"[",
"]",
"directions",
".",
"each",
"do",
"|",
"dir",
"|",
"piece",
",",
"square",
"=",
"first_piece",
"(",
"destination_coor... | From the destination square, move in each direction stopping if we
reach the end of the board. If we encounter a piece, add it to the
list of origin possibilities if it is the moving piece, or else
check the next direction. | [
"From",
"the",
"destination",
"square",
"move",
"in",
"each",
"direction",
"stopping",
"if",
"we",
"reach",
"the",
"end",
"of",
"the",
"board",
".",
"If",
"we",
"encounter",
"a",
"piece",
"add",
"it",
"to",
"the",
"list",
"of",
"origin",
"possibilities",
... | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L202-L212 |
21,233 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.move_origins | def move_origins(moves = nil)
moves ||= MOVES[move.piece.downcase]
possibilities = []
file, rank = destination_coords
moves.each do |i, j|
f = file + i
r = rank + j
if valid_square?(f, r) && self.board.at(f, r) == move.piece
possibilities << [f,... | ruby | def move_origins(moves = nil)
moves ||= MOVES[move.piece.downcase]
possibilities = []
file, rank = destination_coords
moves.each do |i, j|
f = file + i
r = rank + j
if valid_square?(f, r) && self.board.at(f, r) == move.piece
possibilities << [f,... | [
"def",
"move_origins",
"(",
"moves",
"=",
"nil",
")",
"moves",
"||=",
"MOVES",
"[",
"move",
".",
"piece",
".",
"downcase",
"]",
"possibilities",
"=",
"[",
"]",
"file",
",",
"rank",
"=",
"destination_coords",
"moves",
".",
"each",
"do",
"|",
"i",
",",
... | From the destination square, make each move. If it is a valid
square and matches the moving piece, add it to the list of origin
possibilities. | [
"From",
"the",
"destination",
"square",
"make",
"each",
"move",
".",
"If",
"it",
"is",
"a",
"valid",
"square",
"and",
"matches",
"the",
"moving",
"piece",
"add",
"it",
"to",
"the",
"list",
"of",
"origin",
"possibilities",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L218-L233 |
21,234 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.pawn_origins | def pawn_origins
_, rank = destination_coords
double_rank = (rank == 3 && self.move.white?) || (rank == 4 && self.move.black?)
pawn_moves = PAWN_MOVES[self.move.piece]
moves = self.move.capture ? pawn_moves[:capture] : pawn_moves[:normal]
moves += pawn_moves[:double] if double_rank
... | ruby | def pawn_origins
_, rank = destination_coords
double_rank = (rank == 3 && self.move.white?) || (rank == 4 && self.move.black?)
pawn_moves = PAWN_MOVES[self.move.piece]
moves = self.move.capture ? pawn_moves[:capture] : pawn_moves[:normal]
moves += pawn_moves[:double] if double_rank
... | [
"def",
"pawn_origins",
"_",
",",
"rank",
"=",
"destination_coords",
"double_rank",
"=",
"(",
"rank",
"==",
"3",
"&&",
"self",
".",
"move",
".",
"white?",
")",
"||",
"(",
"rank",
"==",
"4",
"&&",
"self",
".",
"move",
".",
"black?",
")",
"pawn_moves",
... | Computes the possbile pawn origins based on the destination square
and whether or not the move is a capture. | [
"Computes",
"the",
"possbile",
"pawn",
"origins",
"based",
"on",
"the",
"destination",
"square",
"and",
"whether",
"or",
"not",
"the",
"move",
"is",
"a",
"capture",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L238-L248 |
21,235 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.disambiguate_san | def disambiguate_san(possibilities)
move.disambiguation ?
possibilities.select {|p| self.board.position_for(p).match(move.disambiguation) } :
possibilities
end | ruby | def disambiguate_san(possibilities)
move.disambiguation ?
possibilities.select {|p| self.board.position_for(p).match(move.disambiguation) } :
possibilities
end | [
"def",
"disambiguate_san",
"(",
"possibilities",
")",
"move",
".",
"disambiguation",
"?",
"possibilities",
".",
"select",
"{",
"|",
"p",
"|",
"self",
".",
"board",
".",
"position_for",
"(",
"p",
")",
".",
"match",
"(",
"move",
".",
"disambiguation",
")",
... | Try to disambiguate based on the standard algebraic notation. | [
"Try",
"to",
"disambiguate",
"based",
"on",
"the",
"standard",
"algebraic",
"notation",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L260-L264 |
21,236 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.disambiguate_pawns | def disambiguate_pawns(possibilities)
self.move.piece.match(/p/i) && !self.move.capture ?
possibilities.reject {|p| self.board.position_for(p).match(/2|7/) } :
possibilities
end | ruby | def disambiguate_pawns(possibilities)
self.move.piece.match(/p/i) && !self.move.capture ?
possibilities.reject {|p| self.board.position_for(p).match(/2|7/) } :
possibilities
end | [
"def",
"disambiguate_pawns",
"(",
"possibilities",
")",
"self",
".",
"move",
".",
"piece",
".",
"match",
"(",
"/",
"/i",
")",
"&&",
"!",
"self",
".",
"move",
".",
"capture",
"?",
"possibilities",
".",
"reject",
"{",
"|",
"p",
"|",
"self",
".",
"board... | A pawn can't move two spaces if there is a pawn in front of it. | [
"A",
"pawn",
"can",
"t",
"move",
"two",
"spaces",
"if",
"there",
"is",
"a",
"pawn",
"in",
"front",
"of",
"it",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L268-L272 |
21,237 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.disambiguate_discovered_check | def disambiguate_discovered_check(possibilities)
DIRECTIONS.each do |attacking_piece, directions|
attacking_piece = attacking_piece.upcase if self.move.black?
directions.each do |dir|
piece, square = first_piece(king_position, dir)
next unless piece == self.move.piece && possi... | ruby | def disambiguate_discovered_check(possibilities)
DIRECTIONS.each do |attacking_piece, directions|
attacking_piece = attacking_piece.upcase if self.move.black?
directions.each do |dir|
piece, square = first_piece(king_position, dir)
next unless piece == self.move.piece && possi... | [
"def",
"disambiguate_discovered_check",
"(",
"possibilities",
")",
"DIRECTIONS",
".",
"each",
"do",
"|",
"attacking_piece",
",",
"directions",
"|",
"attacking_piece",
"=",
"attacking_piece",
".",
"upcase",
"if",
"self",
".",
"move",
".",
"black?",
"directions",
".... | A piece can't move if it would result in a discovered check. | [
"A",
"piece",
"can",
"t",
"move",
"if",
"it",
"would",
"result",
"in",
"a",
"discovered",
"check",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L276-L290 |
21,238 | capicue/pgn | lib/pgn/move_calculator.rb | PGN.MoveCalculator.en_passant_capture | def en_passant_capture
return nil if self.move.castle
if !self.board.at(self.move.destination) && self.move.capture
self.move.destination[0] + self.origin[1]
end
end | ruby | def en_passant_capture
return nil if self.move.castle
if !self.board.at(self.move.destination) && self.move.capture
self.move.destination[0] + self.origin[1]
end
end | [
"def",
"en_passant_capture",
"return",
"nil",
"if",
"self",
".",
"move",
".",
"castle",
"if",
"!",
"self",
".",
"board",
".",
"at",
"(",
"self",
".",
"move",
".",
"destination",
")",
"&&",
"self",
".",
"move",
".",
"capture",
"self",
".",
"move",
"."... | If the move is a capture and there is no piece on the
destination square, it must be an en passant capture. | [
"If",
"the",
"move",
"is",
"a",
"capture",
"and",
"there",
"is",
"no",
"piece",
"on",
"the",
"destination",
"square",
"it",
"must",
"be",
"an",
"en",
"passant",
"capture",
"."
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/move_calculator.rb#L308-L314 |
21,239 | mwunsch/weary | lib/weary/request.rb | Weary.Request.call | def call(environment)
app = adapter.new
middlewares = @middlewares || []
stack = Rack::Builder.new do
middlewares.each do |middleware|
klass, *args = middleware
use klass, *args[0...-1].flatten, &args.last
end
run app
end
stack.call rack_env_defa... | ruby | def call(environment)
app = adapter.new
middlewares = @middlewares || []
stack = Rack::Builder.new do
middlewares.each do |middleware|
klass, *args = middleware
use klass, *args[0...-1].flatten, &args.last
end
run app
end
stack.call rack_env_defa... | [
"def",
"call",
"(",
"environment",
")",
"app",
"=",
"adapter",
".",
"new",
"middlewares",
"=",
"@middlewares",
"||",
"[",
"]",
"stack",
"=",
"Rack",
"::",
"Builder",
".",
"new",
"do",
"middlewares",
".",
"each",
"do",
"|",
"middleware",
"|",
"klass",
"... | A Rack interface for the Request. Applies itself and whatever
middlewares to the env and passes the new env into the adapter.
environment - A Hash for the Rack env.
Returns an Array of three items; a Rack tuple. | [
"A",
"Rack",
"interface",
"for",
"the",
"Request",
".",
"Applies",
"itself",
"and",
"whatever",
"middlewares",
"to",
"the",
"env",
"and",
"passes",
"the",
"new",
"env",
"into",
"the",
"adapter",
"."
] | e36ce4f82d83cbc3d826eaa427acc5e66a0f849b | https://github.com/mwunsch/weary/blob/e36ce4f82d83cbc3d826eaa427acc5e66a0f849b/lib/weary/request.rb#L42-L53 |
21,240 | mwunsch/weary | lib/weary/request.rb | Weary.Request.perform | def perform
future do
status, headers, body = call(rack_env_defaults)
response = Weary::Response.new body, status, headers
yield response if block_given?
response
end
end | ruby | def perform
future do
status, headers, body = call(rack_env_defaults)
response = Weary::Response.new body, status, headers
yield response if block_given?
response
end
end | [
"def",
"perform",
"future",
"do",
"status",
",",
"headers",
",",
"body",
"=",
"call",
"(",
"rack_env_defaults",
")",
"response",
"=",
"Weary",
"::",
"Response",
".",
"new",
"body",
",",
"status",
",",
"headers",
"yield",
"response",
"if",
"block_given?",
"... | Returns a future-wrapped Response. | [
"Returns",
"a",
"future",
"-",
"wrapped",
"Response",
"."
] | e36ce4f82d83cbc3d826eaa427acc5e66a0f849b | https://github.com/mwunsch/weary/blob/e36ce4f82d83cbc3d826eaa427acc5e66a0f849b/lib/weary/request.rb#L115-L122 |
21,241 | mwunsch/weary | lib/weary/request.rb | Weary.Request.query_params_from_hash | def query_params_from_hash(value, prefix = nil)
case value
when Array
value.map { |v| query_params_from_hash(v, "#{prefix}%5B%5D") }.join("&")
when Hash
value.map { |k, v|
query_params_from_hash(v, prefix ? "#{prefix}%5B#{Rack::Utils.escape_path(k)}%5D" : Rack::Utils.escape_p... | ruby | def query_params_from_hash(value, prefix = nil)
case value
when Array
value.map { |v| query_params_from_hash(v, "#{prefix}%5B%5D") }.join("&")
when Hash
value.map { |k, v|
query_params_from_hash(v, prefix ? "#{prefix}%5B#{Rack::Utils.escape_path(k)}%5D" : Rack::Utils.escape_p... | [
"def",
"query_params_from_hash",
"(",
"value",
",",
"prefix",
"=",
"nil",
")",
"case",
"value",
"when",
"Array",
"value",
".",
"map",
"{",
"|",
"v",
"|",
"query_params_from_hash",
"(",
"v",
",",
"\"#{prefix}%5B%5D\"",
")",
"}",
".",
"join",
"(",
"\"&\"",
... | Stolen from Faraday | [
"Stolen",
"from",
"Faraday"
] | e36ce4f82d83cbc3d826eaa427acc5e66a0f849b | https://github.com/mwunsch/weary/blob/e36ce4f82d83cbc3d826eaa427acc5e66a0f849b/lib/weary/request.rb#L127-L141 |
21,242 | meplato/sapoci | lib/sapoci/document.rb | SAPOCI.Document.to_html | def to_html(options = {})
html = []
self.items.each do |item|
html << item.to_html(options)
end
html.join
end | ruby | def to_html(options = {})
html = []
self.items.each do |item|
html << item.to_html(options)
end
html.join
end | [
"def",
"to_html",
"(",
"options",
"=",
"{",
"}",
")",
"html",
"=",
"[",
"]",
"self",
".",
"items",
".",
"each",
"do",
"|",
"item",
"|",
"html",
"<<",
"item",
".",
"to_html",
"(",
"options",
")",
"end",
"html",
".",
"join",
"end"
] | Returns all +items+ as HTML hidden field tags. | [
"Returns",
"all",
"+",
"items",
"+",
"as",
"HTML",
"hidden",
"field",
"tags",
"."
] | 013f6b141d1697f45af624ffbcdc0f1779f9783c | https://github.com/meplato/sapoci/blob/013f6b141d1697f45af624ffbcdc0f1779f9783c/lib/sapoci/document.rb#L44-L50 |
21,243 | ticketevolution/ticketevolution-ruby | lib/ticket_evolution/affiliate_commissions.rb | TicketEvolution.AffiliateCommissions.find_by_office_order | def find_by_office_order(office_id, order_link_id, params=nil)
request(:GET, "/#{office_id}/orders/#{order_link_id}", params) do |response|
singular_class.new(response.body.merge({
:status_code => response.response_code,
:server_message => response.server_message,
:connection... | ruby | def find_by_office_order(office_id, order_link_id, params=nil)
request(:GET, "/#{office_id}/orders/#{order_link_id}", params) do |response|
singular_class.new(response.body.merge({
:status_code => response.response_code,
:server_message => response.server_message,
:connection... | [
"def",
"find_by_office_order",
"(",
"office_id",
",",
"order_link_id",
",",
"params",
"=",
"nil",
")",
"request",
"(",
":GET",
",",
"\"/#{office_id}/orders/#{order_link_id}\"",
",",
"params",
")",
"do",
"|",
"response",
"|",
"singular_class",
".",
"new",
"(",
"r... | Find affiliate commission of the office at the time the order was created | [
"Find",
"affiliate",
"commission",
"of",
"the",
"office",
"at",
"the",
"time",
"the",
"order",
"was",
"created"
] | 8666c645144ceaf546236b3977c665b3191a483e | https://github.com/ticketevolution/ticketevolution-ruby/blob/8666c645144ceaf546236b3977c665b3191a483e/lib/ticket_evolution/affiliate_commissions.rb#L8-L16 |
21,244 | capicue/pgn | lib/pgn/game.rb | PGN.Game.play | def play
index = 0
hist = Array.new(3, "")
loop do
puts "\e[H\e[2J"
puts self.positions[index].inspect
hist[0..2] = (hist[1..2] << STDIN.getch)
case hist.join
when LEFT
index -= 1 if index > 0
when RIGHT
index += 1 if index < self.m... | ruby | def play
index = 0
hist = Array.new(3, "")
loop do
puts "\e[H\e[2J"
puts self.positions[index].inspect
hist[0..2] = (hist[1..2] << STDIN.getch)
case hist.join
when LEFT
index -= 1 if index > 0
when RIGHT
index += 1 if index < self.m... | [
"def",
"play",
"index",
"=",
"0",
"hist",
"=",
"Array",
".",
"new",
"(",
"3",
",",
"\"\"",
")",
"loop",
"do",
"puts",
"\"\\e[H\\e[2J\"",
"puts",
"self",
".",
"positions",
"[",
"index",
"]",
".",
"inspect",
"hist",
"[",
"0",
"..",
"2",
"]",
"=",
"... | Interactively step through the game
Use +d+ to move forward, +a+ to move backward, and +^C+ to exit. | [
"Interactively",
"step",
"through",
"the",
"game"
] | d7e3a0839bbf7e4216409b419bd85f171a840c87 | https://github.com/capicue/pgn/blob/d7e3a0839bbf7e4216409b419bd85f171a840c87/lib/pgn/game.rb#L116-L134 |
21,245 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.url_to_animation | def url_to_animation(url, options = nil)
if options == nil
options = AnimationOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + "takeanimation.ashx", false, options, url)
return nil
end | ruby | def url_to_animation(url, options = nil)
if options == nil
options = AnimationOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + "takeanimation.ashx", false, options, url)
return nil
end | [
"def",
"url_to_animation",
"(",
"url",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"AnimationOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"... | Create a new instance of the Client class in order to access the GrabzIt API.
@param applicationKey [String] your application key
@param applicationSecret [String] your application secret
@see http://grabz.it/register.aspx You can get an application key and secret by registering for free with GrabzIt
This method s... | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"Client",
"class",
"in",
"order",
"to",
"access",
"the",
"GrabzIt",
"API",
"."
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L69-L77 |
21,246 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.url_to_image | def url_to_image(url, options = nil)
if options == nil
options = ImageOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakePicture, false, options, url)
return nil
end | ruby | def url_to_image(url, options = nil)
if options == nil
options = ImageOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakePicture, false, options, url)
return nil
end | [
"def",
"url_to_image",
"(",
"url",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"ImageOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"+",
"T... | This method specifies the URL that should be converted into a image screenshot
@param url [String] the URL to capture as a screenshot
@param options [ImageOptions, nil] a instance of the ImageOptions class that defines any special options to use when creating the screenshot
@return [void] | [
"This",
"method",
"specifies",
"the",
"URL",
"that",
"should",
"be",
"converted",
"into",
"a",
"image",
"screenshot"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L84-L92 |
21,247 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.html_to_image | def html_to_image(html, options = nil)
if options == nil
options = ImageOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakePicture, true, options, html)
return nil
end | ruby | def html_to_image(html, options = nil)
if options == nil
options = ImageOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakePicture, true, options, html)
return nil
end | [
"def",
"html_to_image",
"(",
"html",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"ImageOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLPost",
"+",
... | This method specifies the HTML that should be converted into a image
@param html [String] the HTML to convert into a image
@param options [ImageOptions, nil] a instance of the ImageOptions class that defines any special options to use when creating the image
@return [void] | [
"This",
"method",
"specifies",
"the",
"HTML",
"that",
"should",
"be",
"converted",
"into",
"a",
"image"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L99-L107 |
21,248 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.url_to_table | def url_to_table(url, options = nil)
if options == nil
options = TableOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakeTable, false, options, url)
return nil
end | ruby | def url_to_table(url, options = nil)
if options == nil
options = TableOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakeTable, false, options, url)
return nil
end | [
"def",
"url_to_table",
"(",
"url",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"TableOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"+",
"T... | This method specifies the URL that the HTML tables should be extracted from
@param url [String] the URL to extract HTML tables from
@param options [TableOptions, nil] a instance of the TableOptions class that defines any special options to use when converting the HTML table
@return [void] | [
"This",
"method",
"specifies",
"the",
"URL",
"that",
"the",
"HTML",
"tables",
"should",
"be",
"extracted",
"from"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L123-L131 |
21,249 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.html_to_table | def html_to_table(html, options = nil)
if options == nil
options = TableOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakeTable, true, options, html)
return nil
end | ruby | def html_to_table(html, options = nil)
if options == nil
options = TableOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakeTable, true, options, html)
return nil
end | [
"def",
"html_to_table",
"(",
"html",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"TableOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLPost",
"+",
... | This method specifies the HTML that the HTML tables should be extracted from
@param html [String] the HTML to extract HTML tables from
@param options [TableOptions, nil] a instance of the TableOptions class that defines any special options to use when converting the HTML table
@return [void] | [
"This",
"method",
"specifies",
"the",
"HTML",
"that",
"the",
"HTML",
"tables",
"should",
"be",
"extracted",
"from"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L138-L146 |
21,250 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.url_to_pdf | def url_to_pdf(url, options = nil)
if options == nil
options = PDFOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakePDF, false, options, url)
return nil
end | ruby | def url_to_pdf(url, options = nil)
if options == nil
options = PDFOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakePDF, false, options, url)
return nil
end | [
"def",
"url_to_pdf",
"(",
"url",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"PDFOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"+",
"TakeP... | This method specifies the URL that should be converted into a PDF
@param url [String] the URL to capture as a PDF
@param options [PDFOptions, nil] a instance of the PDFOptions class that defines any special options to use when creating the PDF
@return [void] | [
"This",
"method",
"specifies",
"the",
"URL",
"that",
"should",
"be",
"converted",
"into",
"a",
"PDF"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L162-L170 |
21,251 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.html_to_pdf | def html_to_pdf(html, options = nil)
if options == nil
options = PDFOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakePDF, true, options, html)
return nil
end | ruby | def html_to_pdf(html, options = nil)
if options == nil
options = PDFOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakePDF, true, options, html)
return nil
end | [
"def",
"html_to_pdf",
"(",
"html",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"PDFOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLPost",
"+",
"Ta... | This method specifies the HTML that should be converted into a PDF
@param html [String] the HTML to convert into a PDF
@param options [PDFOptions, nil] a instance of the PDFOptions class that defines any special options to use when creating the PDF
@return [void] | [
"This",
"method",
"specifies",
"the",
"HTML",
"that",
"should",
"be",
"converted",
"into",
"a",
"PDF"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L177-L185 |
21,252 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.url_to_docx | def url_to_docx(url, options = nil)
if options == nil
options = DOCXOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakeDOCX, false, options, url)
return nil
end | ruby | def url_to_docx(url, options = nil)
if options == nil
options = DOCXOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLGet + TakeDOCX, false, options, url)
return nil
end | [
"def",
"url_to_docx",
"(",
"url",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"DOCXOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"+",
"Tak... | This method specifies the URL that should be converted into a DOCX
@param url [String] the URL to capture as a DOCX
@param options [DOCXOptions, nil] a instance of the DOCXOptions class that defines any special options to use when creating the DOCX
@return [void] | [
"This",
"method",
"specifies",
"the",
"URL",
"that",
"should",
"be",
"converted",
"into",
"a",
"DOCX"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L201-L209 |
21,253 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.html_to_docx | def html_to_docx(html, options = nil)
if options == nil
options = DOCXOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakeDOCX, true, options, html)
return nil
end | ruby | def html_to_docx(html, options = nil)
if options == nil
options = DOCXOptions.new()
end
@request = Request.new(@protocol + WebServicesBaseURLPost + TakeDOCX, true, options, html)
return nil
end | [
"def",
"html_to_docx",
"(",
"html",
",",
"options",
"=",
"nil",
")",
"if",
"options",
"==",
"nil",
"options",
"=",
"DOCXOptions",
".",
"new",
"(",
")",
"end",
"@request",
"=",
"Request",
".",
"new",
"(",
"@protocol",
"+",
"WebServicesBaseURLPost",
"+",
"... | This method specifies the HTML that should be converted into a DOCX
@param html [String] the HTML to convert into a DOCX
@param options [DOCXOptions, nil] a instance of the DOCXOptions class that defines any special options to use when creating the DOCX
@return [void] | [
"This",
"method",
"specifies",
"the",
"HTML",
"that",
"should",
"be",
"converted",
"into",
"a",
"DOCX"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L216-L224 |
21,254 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.save | def save(callBackURL = nil)
if @request == nil
raise GrabzItException.new("No parameters have been set.", GrabzItException::PARAMETER_MISSING_PARAMETERS)
end
sig = encode(@request.options()._getSignatureString(GrabzIt::Utility.nil_check(@applicationSecret), callBackURL, @request.getTargetUrl()))
... | ruby | def save(callBackURL = nil)
if @request == nil
raise GrabzItException.new("No parameters have been set.", GrabzItException::PARAMETER_MISSING_PARAMETERS)
end
sig = encode(@request.options()._getSignatureString(GrabzIt::Utility.nil_check(@applicationSecret), callBackURL, @request.getTargetUrl()))
... | [
"def",
"save",
"(",
"callBackURL",
"=",
"nil",
")",
"if",
"@request",
"==",
"nil",
"raise",
"GrabzItException",
".",
"new",
"(",
"\"No parameters have been set.\"",
",",
"GrabzItException",
"::",
"PARAMETER_MISSING_PARAMETERS",
")",
"end",
"sig",
"=",
"encode",
"(... | Calls the GrabzIt web service to take the screenshot
The handler will be passed a URL with the following query string parameters:
- message (is any error message associated with the screenshot)
- customId (is a custom id you may have specified in the [AnimationOptions], [ImageOptions], [PDFOptions] or [TableOptions... | [
"Calls",
"the",
"GrabzIt",
"web",
"service",
"to",
"take",
"the",
"screenshot"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L247-L265 |
21,255 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.save_to | def save_to(saveToFile = nil)
id = save()
if id == nil || id == ""
return false
end
#Wait for it to be possibly ready
sleep((@request.options().startDelay() / 1000) + 3)
#Wait for it to be ready.
while true do
status = get_status(id)
if !status.cached && !status.processing
... | ruby | def save_to(saveToFile = nil)
id = save()
if id == nil || id == ""
return false
end
#Wait for it to be possibly ready
sleep((@request.options().startDelay() / 1000) + 3)
#Wait for it to be ready.
while true do
status = get_status(id)
if !status.cached && !status.processing
... | [
"def",
"save_to",
"(",
"saveToFile",
"=",
"nil",
")",
"id",
"=",
"save",
"(",
")",
"if",
"id",
"==",
"nil",
"||",
"id",
"==",
"\"\"",
"return",
"false",
"end",
"#Wait for it to be possibly ready",
"sleep",
"(",
"(",
"@request",
".",
"options",
"(",
")",
... | Calls the GrabzIt web service to take the screenshot and saves it to the target path provided. if no target path is provided
it returns the screenshot byte data.
@note Warning, this is a SYNCHONOUS method and can take up to 5 minutes before a response
@param saveToFile [String, nil] the file path that the screensho... | [
"Calls",
"the",
"GrabzIt",
"web",
"service",
"to",
"take",
"the",
"screenshot",
"and",
"saves",
"it",
"to",
"the",
"target",
"path",
"provided",
".",
"if",
"no",
"target",
"path",
"is",
"provided",
"it",
"returns",
"the",
"screenshot",
"byte",
"data",
"."
... | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L276-L315 |
21,256 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.get_status | def get_status(id)
if id == nil || id == ""
return nil
end
result = get(@protocol + WebServicesBaseURLGet + "getstatus.ashx?id=" + GrabzIt::Utility.nil_check(id))
doc = REXML::Document.new(result)
processing = doc.root.elements["Processing"].text()
cached = doc.root.elements["Cached"]... | ruby | def get_status(id)
if id == nil || id == ""
return nil
end
result = get(@protocol + WebServicesBaseURLGet + "getstatus.ashx?id=" + GrabzIt::Utility.nil_check(id))
doc = REXML::Document.new(result)
processing = doc.root.elements["Processing"].text()
cached = doc.root.elements["Cached"]... | [
"def",
"get_status",
"(",
"id",
")",
"if",
"id",
"==",
"nil",
"||",
"id",
"==",
"\"\"",
"return",
"nil",
"end",
"result",
"=",
"get",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"+",
"\"getstatus.ashx?id=\"",
"+",
"GrabzIt",
"::",
"Utility",
".",
"nil_... | Get the current status of a GrabzIt screenshot
@param id [String] the id of the screenshot
@return [ScreenShotStatus] a object representing the status of the screenshot | [
"Get",
"the",
"current",
"status",
"of",
"a",
"GrabzIt",
"screenshot"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L321-L337 |
21,257 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.get_result | def get_result(id)
if id == nil || id == ""
return nil
end
return get(@protocol + WebServicesBaseURLGet + "getfile.ashx?id=" + GrabzIt::Utility.nil_check(id))
end | ruby | def get_result(id)
if id == nil || id == ""
return nil
end
return get(@protocol + WebServicesBaseURLGet + "getfile.ashx?id=" + GrabzIt::Utility.nil_check(id))
end | [
"def",
"get_result",
"(",
"id",
")",
"if",
"id",
"==",
"nil",
"||",
"id",
"==",
"\"\"",
"return",
"nil",
"end",
"return",
"get",
"(",
"@protocol",
"+",
"WebServicesBaseURLGet",
"+",
"\"getfile.ashx?id=\"",
"+",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
... | This method returns the screenshot itself. If nothing is returned then something has gone wrong or the screenshot is not ready yet
@param id [String] the id of the screenshot
@return [Object] returns the screenshot
@raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a... | [
"This",
"method",
"returns",
"the",
"screenshot",
"itself",
".",
"If",
"nothing",
"is",
"returned",
"then",
"something",
"has",
"gone",
"wrong",
"or",
"the",
"screenshot",
"is",
"not",
"ready",
"yet"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L344-L350 |
21,258 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.get_cookies | def get_cookies(domain)
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(domain))
qs = "key="
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
qs.concat("&domain=")
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(domain)))
qs.... | ruby | def get_cookies(domain)
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(domain))
qs = "key="
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
qs.concat("&domain=")
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(domain)))
qs.... | [
"def",
"get_cookies",
"(",
"domain",
")",
"sig",
"=",
"encode",
"(",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"@applicationSecret",
")",
"+",
"\"|\"",
"+",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"domain",
")",
")",
"qs",
"=",
"\"key... | Get all the cookies that GrabzIt is using for a particular domain. This may include your user set cookies as well
@param domain [String] the domain to return cookies for
@return [Array<Cookie>] an array of cookies
@raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a ... | [
"Get",
"all",
"the",
"cookies",
"that",
"GrabzIt",
"is",
"using",
"for",
"a",
"particular",
"domain",
".",
"This",
"may",
"include",
"your",
"user",
"set",
"cookies",
"as",
"well"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L357-L386 |
21,259 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.set_cookie | def set_cookie(name, domain, value = "", path = "/", httponly = false, expires = "")
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(name)+"|"+GrabzIt::Utility.nil_check(domain)+
"|"+GrabzIt::Utility.nil_check(value)+"|"+GrabzIt::Utility.nil_check(path)+"|"+GrabzIt::Util... | ruby | def set_cookie(name, domain, value = "", path = "/", httponly = false, expires = "")
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(name)+"|"+GrabzIt::Utility.nil_check(domain)+
"|"+GrabzIt::Utility.nil_check(value)+"|"+GrabzIt::Utility.nil_check(path)+"|"+GrabzIt::Util... | [
"def",
"set_cookie",
"(",
"name",
",",
"domain",
",",
"value",
"=",
"\"\"",
",",
"path",
"=",
"\"/\"",
",",
"httponly",
"=",
"false",
",",
"expires",
"=",
"\"\"",
")",
"sig",
"=",
"encode",
"(",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"@ap... | Sets a new custom cookie on GrabzIt, if the custom cookie has the same name and domain as a global cookie the global
cookie is overridden
@note This can be useful if a websites functionality is controlled by cookies
@param name [String] the name of the cookie to set
@param domain [String] the domain of the website... | [
"Sets",
"a",
"new",
"custom",
"cookie",
"on",
"GrabzIt",
"if",
"the",
"custom",
"cookie",
"has",
"the",
"same",
"name",
"and",
"domain",
"as",
"a",
"global",
"cookie",
"the",
"global"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L400-L423 |
21,260 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.delete_cookie | def delete_cookie(name, domain)
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(name)+
"|"+GrabzIt::Utility.nil_check(domain)+"|1")
qs = "key="
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
qs.concat("&domain=")
qs.concat(CGI.escape(Grab... | ruby | def delete_cookie(name, domain)
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(name)+
"|"+GrabzIt::Utility.nil_check(domain)+"|1")
qs = "key="
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
qs.concat("&domain=")
qs.concat(CGI.escape(Grab... | [
"def",
"delete_cookie",
"(",
"name",
",",
"domain",
")",
"sig",
"=",
"encode",
"(",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"@applicationSecret",
")",
"+",
"\"|\"",
"+",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"name",
")",
"+",
"\"|... | Delete a custom cookie or block a global cookie from being used
@param name [String] the name of the cookie to delete
@param domain [String] the website the cookie belongs to
@return [Boolean] returns true if the cookie was successfully set
@raise [RuntimeError] if the GrabzIt service reports an error with the req... | [
"Delete",
"a",
"custom",
"cookie",
"or",
"block",
"a",
"global",
"cookie",
"from",
"being",
"used"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L431-L445 |
21,261 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.add_watermark | def add_watermark(identifier, path, xpos, ypos)
if !File.file?(path)
raise "File: " + path + " does not exist"
end
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier)+"|"+GrabzIt::Utility.nil_int_check(xpos)+
"|"+GrabzIt::Utility.nil_int_check(ypos))
... | ruby | def add_watermark(identifier, path, xpos, ypos)
if !File.file?(path)
raise "File: " + path + " does not exist"
end
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier)+"|"+GrabzIt::Utility.nil_int_check(xpos)+
"|"+GrabzIt::Utility.nil_int_check(ypos))
... | [
"def",
"add_watermark",
"(",
"identifier",
",",
"path",
",",
"xpos",
",",
"ypos",
")",
"if",
"!",
"File",
".",
"file?",
"(",
"path",
")",
"raise",
"\"File: \"",
"+",
"path",
"+",
"\" does not exist\"",
"end",
"sig",
"=",
"encode",
"(",
"GrabzIt",
"::",
... | Add a new custom watermark
@param identifier [String] the identifier you want to give the custom watermark. It is important that this identifier is unique.
@param path [String] the absolute path of the watermark on your server. For instance C:/watermark/1.png
@param xpos [Integer] the horizontal position you want t... | [
"Add",
"a",
"new",
"custom",
"watermark"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L475-L527 |
21,262 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.delete_watermark | def delete_watermark(identifier)
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier))
qs = "key="
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
qs.concat("&identifier=")
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(identifier)))
... | ruby | def delete_watermark(identifier)
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier))
qs = "key="
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
qs.concat("&identifier=")
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(identifier)))
... | [
"def",
"delete_watermark",
"(",
"identifier",
")",
"sig",
"=",
"encode",
"(",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"@applicationSecret",
")",
"+",
"\"|\"",
"+",
"GrabzIt",
"::",
"Utility",
".",
"nil_check",
"(",
"identifier",
")",
")",
"qs",
... | Delete a custom watermark
@param identifier [String] the identifier of the custom watermark you want to delete
@return [Boolean] returns true if the watermark was successfully deleted
@raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a RuntimeError | [
"Delete",
"a",
"custom",
"watermark"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L534-L545 |
21,263 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.set_local_proxy | def set_local_proxy(value)
if value
uri = URI.parse(value)
@proxy = Proxy.new(uri.host, uri.port, uri.user, uri.password)
else
@proxy = Proxy.new()
end
end | ruby | def set_local_proxy(value)
if value
uri = URI.parse(value)
@proxy = Proxy.new(uri.host, uri.port, uri.user, uri.password)
else
@proxy = Proxy.new()
end
end | [
"def",
"set_local_proxy",
"(",
"value",
")",
"if",
"value",
"uri",
"=",
"URI",
".",
"parse",
"(",
"value",
")",
"@proxy",
"=",
"Proxy",
".",
"new",
"(",
"uri",
".",
"host",
",",
"uri",
".",
"port",
",",
"uri",
".",
"user",
",",
"uri",
".",
"passw... | This method enables a local proxy server to be used for all requests
@param value [String] the URL, which can include a port if required, of the proxy. Providing a null will remove any previously set proxy | [
"This",
"method",
"enables",
"a",
"local",
"proxy",
"server",
"to",
"be",
"used",
"for",
"all",
"requests"
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L561-L568 |
21,264 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.decrypt_file | def decrypt_file(path, key)
data = read_file(path)
decryptedFile = File.new(path, "wb")
decryptedFile.write(decrypt(data, key))
decryptedFile.close
end | ruby | def decrypt_file(path, key)
data = read_file(path)
decryptedFile = File.new(path, "wb")
decryptedFile.write(decrypt(data, key))
decryptedFile.close
end | [
"def",
"decrypt_file",
"(",
"path",
",",
"key",
")",
"data",
"=",
"read_file",
"(",
"path",
")",
"decryptedFile",
"=",
"File",
".",
"new",
"(",
"path",
",",
"\"wb\"",
")",
"decryptedFile",
".",
"write",
"(",
"decrypt",
"(",
"data",
",",
"key",
")",
"... | This method will decrypt a encrypted capture file, using the key you passed to the encryption key parameter.
@param path [String] the path of the encrypted capture
@param key [String] the encryption key | [
"This",
"method",
"will",
"decrypt",
"a",
"encrypted",
"capture",
"file",
"using",
"the",
"key",
"you",
"passed",
"to",
"the",
"encryption",
"key",
"parameter",
"."
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L581-L586 |
21,265 | GrabzIt/grabzit | ruby/GrabzIt/lib/grabzit/client.rb | GrabzIt.Client.decrypt | def decrypt(data, key)
if data == nil
return nil
end
iv = data[0..15]
payload = data[16..-1]
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
cipher.padding = 0
cipher.key = Base64.strict_decode64(key);
cipher.iv = iv
decrypted = cipher.update(payload);
decrypted << cipher.final();
... | ruby | def decrypt(data, key)
if data == nil
return nil
end
iv = data[0..15]
payload = data[16..-1]
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
cipher.padding = 0
cipher.key = Base64.strict_decode64(key);
cipher.iv = iv
decrypted = cipher.update(payload);
decrypted << cipher.final();
... | [
"def",
"decrypt",
"(",
"data",
",",
"key",
")",
"if",
"data",
"==",
"nil",
"return",
"nil",
"end",
"iv",
"=",
"data",
"[",
"0",
"..",
"15",
"]",
"payload",
"=",
"data",
"[",
"16",
"..",
"-",
"1",
"]",
"cipher",
"=",
"OpenSSL",
"::",
"Cipher",
"... | This method will decrypt a encrypted capture, using the key you passed to the encryption key parameter.
@param path [String] the encrypted bytes
@param key [String] the encryption key
@return [Array<Byte>] an array of decrypted bytes | [
"This",
"method",
"will",
"decrypt",
"a",
"encrypted",
"capture",
"using",
"the",
"key",
"you",
"passed",
"to",
"the",
"encryption",
"key",
"parameter",
"."
] | 9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c | https://github.com/GrabzIt/grabzit/blob/9ab5dfd32ae7cf3c5fcd29f13e980fd5d266391c/ruby/GrabzIt/lib/grabzit/client.rb#L593-L606 |
21,266 | notEthan/api_hammer | lib/api_hammer/halt_methods.rb | ApiHammer.HaltMethods.halt_error | def halt_error(status, errors, options = {})
errors_as_json = errors.respond_to?(:as_json) ? errors.as_json : errors
unless errors_as_json.is_a?(Hash)
raise ArgumentError, "errors be an object representable in JSON as a Hash; got errors = #{errors.inspect}"
end
unless errors_as_json.keys... | ruby | def halt_error(status, errors, options = {})
errors_as_json = errors.respond_to?(:as_json) ? errors.as_json : errors
unless errors_as_json.is_a?(Hash)
raise ArgumentError, "errors be an object representable in JSON as a Hash; got errors = #{errors.inspect}"
end
unless errors_as_json.keys... | [
"def",
"halt_error",
"(",
"status",
",",
"errors",
",",
"options",
"=",
"{",
"}",
")",
"errors_as_json",
"=",
"errors",
".",
"respond_to?",
"(",
":as_json",
")",
"?",
"errors",
".",
"as_json",
":",
"errors",
"unless",
"errors_as_json",
".",
"is_a?",
"(",
... | halt and render the given errors in the body on the 'errors' key | [
"halt",
"and",
"render",
"the",
"given",
"errors",
"in",
"the",
"body",
"on",
"the",
"errors",
"key"
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/halt_methods.rb#L4-L38 |
21,267 | notEthan/api_hammer | lib/api_hammer/sinatra.rb | ApiHammer.Sinatra.format_response | def format_response(status, body_object, headers={})
if status == 204
body = ''
else
body = case response_media_type
when 'application/json'
JSON.pretty_generate(body_object)
when 'application/x-www-form-urlencoded'
URI.encode_www_form(body_object)
... | ruby | def format_response(status, body_object, headers={})
if status == 204
body = ''
else
body = case response_media_type
when 'application/json'
JSON.pretty_generate(body_object)
when 'application/x-www-form-urlencoded'
URI.encode_www_form(body_object)
... | [
"def",
"format_response",
"(",
"status",
",",
"body_object",
",",
"headers",
"=",
"{",
"}",
")",
"if",
"status",
"==",
"204",
"body",
"=",
"''",
"else",
"body",
"=",
"case",
"response_media_type",
"when",
"'application/json'",
"JSON",
".",
"pretty_generate",
... | returns a rack response with the given object encoded in the appropriate format for the requests.
arguments are in the order of what tends to vary most frequently
rather than rack's way, so headers come last | [
"returns",
"a",
"rack",
"response",
"with",
"the",
"given",
"object",
"encoded",
"in",
"the",
"appropriate",
"format",
"for",
"the",
"requests",
"."
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/sinatra.rb#L107-L127 |
21,268 | notEthan/api_hammer | lib/api_hammer/sinatra.rb | ApiHammer.Sinatra.request_body | def request_body
# rewind in case anything in the past has left this un-rewound
request.body.rewind
request.body.read.tap do
# rewind in case anything in the future expects this to have been left rewound
request.body.rewind
end
end | ruby | def request_body
# rewind in case anything in the past has left this un-rewound
request.body.rewind
request.body.read.tap do
# rewind in case anything in the future expects this to have been left rewound
request.body.rewind
end
end | [
"def",
"request_body",
"# rewind in case anything in the past has left this un-rewound ",
"request",
".",
"body",
".",
"rewind",
"request",
".",
"body",
".",
"read",
".",
"tap",
"do",
"# rewind in case anything in the future expects this to have been left rewound ",
"request",
".... | reads the request body | [
"reads",
"the",
"request",
"body"
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/sinatra.rb#L130-L137 |
21,269 | notEthan/api_hammer | lib/api_hammer/sinatra.rb | ApiHammer.Sinatra.parsed_body | def parsed_body
request_media_type = request.media_type
unless request_media_type =~ /\S/
fallback = true
request_media_type = supported_media_types.first
end
case request_media_type
when 'application/json'
begin
return JSON.parse(request_body)
res... | ruby | def parsed_body
request_media_type = request.media_type
unless request_media_type =~ /\S/
fallback = true
request_media_type = supported_media_types.first
end
case request_media_type
when 'application/json'
begin
return JSON.parse(request_body)
res... | [
"def",
"parsed_body",
"request_media_type",
"=",
"request",
".",
"media_type",
"unless",
"request_media_type",
"=~",
"/",
"\\S",
"/",
"fallback",
"=",
"true",
"request_media_type",
"=",
"supported_media_types",
".",
"first",
"end",
"case",
"request_media_type",
"when"... | returns the parsed contents of the request body.
checks the Content-Type of the request, and unless it's supported (or omitted - in which case assumed to be the
first supported media type), halts with 415.
if the body is not parseable, then halts with 400. | [
"returns",
"the",
"parsed",
"contents",
"of",
"the",
"request",
"body",
"."
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/sinatra.rb#L145-L187 |
21,270 | notEthan/api_hammer | lib/api_hammer/sinatra.rb | ApiHammer.Sinatra.check_params_and_object_consistent | def check_params_and_object_consistent(path_params, object)
errors = {}
path_params.each do |(k, v)|
if object.key?(k) && object[k] != v
errors[k] = [I18n.t('app.errors.inconsistent_uri_and_entity',
:key => k,
:uri_value => v,
:entity_value => object[k],... | ruby | def check_params_and_object_consistent(path_params, object)
errors = {}
path_params.each do |(k, v)|
if object.key?(k) && object[k] != v
errors[k] = [I18n.t('app.errors.inconsistent_uri_and_entity',
:key => k,
:uri_value => v,
:entity_value => object[k],... | [
"def",
"check_params_and_object_consistent",
"(",
"path_params",
",",
"object",
")",
"errors",
"=",
"{",
"}",
"path_params",
".",
"each",
"do",
"|",
"(",
"k",
",",
"v",
")",
"|",
"if",
"object",
".",
"key?",
"(",
"k",
")",
"&&",
"object",
"[",
"k",
"... | for methods where parameters which are required in the path may also be specified in the
body, this takes the path_params and the body object and ensures that they are consistent
any place they are specified in the body. | [
"for",
"methods",
"where",
"parameters",
"which",
"are",
"required",
"in",
"the",
"path",
"may",
"also",
"be",
"specified",
"in",
"the",
"body",
"this",
"takes",
"the",
"path_params",
"and",
"the",
"body",
"object",
"and",
"ensures",
"that",
"they",
"are",
... | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/sinatra.rb#L192-L207 |
21,271 | notEthan/api_hammer | lib/api_hammer/body.rb | ApiHammer.Body.object | def object
instance_variable_defined?(:@object) ? @object : @object = begin
if media_type == 'application/json'
JSON.parse(body) rescue nil
elsif media_type == 'application/x-www-form-urlencoded'
CGI.parse(body).map { |k, vs| {k => vs.last} }.inject({}, &:update)
end
... | ruby | def object
instance_variable_defined?(:@object) ? @object : @object = begin
if media_type == 'application/json'
JSON.parse(body) rescue nil
elsif media_type == 'application/x-www-form-urlencoded'
CGI.parse(body).map { |k, vs| {k => vs.last} }.inject({}, &:update)
end
... | [
"def",
"object",
"instance_variable_defined?",
"(",
":@object",
")",
"?",
"@object",
":",
"@object",
"=",
"begin",
"if",
"media_type",
"==",
"'application/json'",
"JSON",
".",
"parse",
"(",
"body",
")",
"rescue",
"nil",
"elsif",
"media_type",
"==",
"'application... | parses the body to an object | [
"parses",
"the",
"body",
"to",
"an",
"object"
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/body.rb#L13-L21 |
21,272 | notEthan/api_hammer | lib/api_hammer/body.rb | ApiHammer.Body.jsonifiable | def jsonifiable
@jsonifiable ||= Body.new(catch(:jsonifiable) do
original_body = self.body
unless original_body.is_a?(String)
begin
# if the response body is not a string, but JSON doesn't complain
# about dumping whatever it is, go ahead and use it
J... | ruby | def jsonifiable
@jsonifiable ||= Body.new(catch(:jsonifiable) do
original_body = self.body
unless original_body.is_a?(String)
begin
# if the response body is not a string, but JSON doesn't complain
# about dumping whatever it is, go ahead and use it
J... | [
"def",
"jsonifiable",
"@jsonifiable",
"||=",
"Body",
".",
"new",
"(",
"catch",
"(",
":jsonifiable",
")",
"do",
"original_body",
"=",
"self",
".",
"body",
"unless",
"original_body",
".",
"is_a?",
"(",
"String",
")",
"begin",
"# if the response body is not a string,... | deal with the vagaries of getting the response body in a form which JSON
gem will not cry about generating | [
"deal",
"with",
"the",
"vagaries",
"of",
"getting",
"the",
"response",
"body",
"in",
"a",
"form",
"which",
"JSON",
"gem",
"will",
"not",
"cry",
"about",
"generating"
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/body.rb#L49-L101 |
21,273 | notEthan/api_hammer | lib/api_hammer/faraday/outputter.rb | ApiHammer.FaradayCurlVOutputter.alter_body_by_content_type | def alter_body_by_content_type(body, content_type)
return body unless body.is_a?(String)
content_type_attrs = ApiHammer::ContentTypeAttrs.new(content_type)
if @options[:text].nil? ? content_type_attrs.text? : @options[:text]
if pretty?
case content_type_attrs.media_type
whe... | ruby | def alter_body_by_content_type(body, content_type)
return body unless body.is_a?(String)
content_type_attrs = ApiHammer::ContentTypeAttrs.new(content_type)
if @options[:text].nil? ? content_type_attrs.text? : @options[:text]
if pretty?
case content_type_attrs.media_type
whe... | [
"def",
"alter_body_by_content_type",
"(",
"body",
",",
"content_type",
")",
"return",
"body",
"unless",
"body",
".",
"is_a?",
"(",
"String",
")",
"content_type_attrs",
"=",
"ApiHammer",
"::",
"ContentTypeAttrs",
".",
"new",
"(",
"content_type",
")",
"if",
"@opti... | takes a body and a content type; returns the body, altered according to options.
- with coloring (ansi colors for terminals) possibly added, if it's a recognized content type and
#color? is true
- formatted prettily if #pretty? is true | [
"takes",
"a",
"body",
"and",
"a",
"content",
"type",
";",
"returns",
"the",
"body",
"altered",
"according",
"to",
"options",
"."
] | a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e | https://github.com/notEthan/api_hammer/blob/a5ebc1b9e8c1635035a6b600a81b3d52cc673a8e/lib/api_hammer/faraday/outputter.rb#L129-L154 |
21,274 | ekylibre/active_list | lib/active_list/generator/finder.rb | ActiveList.Generator.select_data_code | def select_data_code(options = {})
paginate = (options.key?(:paginate) ? options[:paginate] : @table.paginate?)
# Check order
unless @table.options.keys.include?(:order)
columns = @table.table_columns
@table.options[:order] = (columns.any? ? columns.first.name.to_sym : { id: :desc })
... | ruby | def select_data_code(options = {})
paginate = (options.key?(:paginate) ? options[:paginate] : @table.paginate?)
# Check order
unless @table.options.keys.include?(:order)
columns = @table.table_columns
@table.options[:order] = (columns.any? ? columns.first.name.to_sym : { id: :desc })
... | [
"def",
"select_data_code",
"(",
"options",
"=",
"{",
"}",
")",
"paginate",
"=",
"(",
"options",
".",
"key?",
"(",
":paginate",
")",
"?",
"options",
"[",
":paginate",
"]",
":",
"@table",
".",
"paginate?",
")",
"# Check order",
"unless",
"@table",
".",
"op... | Generate select code for the table taking all parameters in account | [
"Generate",
"select",
"code",
"for",
"the",
"table",
"taking",
"all",
"parameters",
"in",
"account"
] | 7d27d246ae6834af68eadcb567597bd78487d5fd | https://github.com/ekylibre/active_list/blob/7d27d246ae6834af68eadcb567597bd78487d5fd/lib/active_list/generator/finder.rb#L5-L66 |
21,275 | ekylibre/active_list | lib/active_list/generator/finder.rb | ActiveList.Generator.includes_reflections | def includes_reflections
hash = []
@table.columns.each do |column|
hash << column.reflection.name if column.respond_to?(:reflection)
end
hash
end | ruby | def includes_reflections
hash = []
@table.columns.each do |column|
hash << column.reflection.name if column.respond_to?(:reflection)
end
hash
end | [
"def",
"includes_reflections",
"hash",
"=",
"[",
"]",
"@table",
".",
"columns",
".",
"each",
"do",
"|",
"column",
"|",
"hash",
"<<",
"column",
".",
"reflection",
".",
"name",
"if",
"column",
".",
"respond_to?",
"(",
":reflection",
")",
"end",
"hash",
"en... | Compute includes Hash | [
"Compute",
"includes",
"Hash"
] | 7d27d246ae6834af68eadcb567597bd78487d5fd | https://github.com/ekylibre/active_list/blob/7d27d246ae6834af68eadcb567597bd78487d5fd/lib/active_list/generator/finder.rb#L71-L77 |
21,276 | ekylibre/active_list | lib/active_list/generator/finder.rb | ActiveList.Generator.conditions_code | def conditions_code
conditions = @table.options[:conditions]
code = ''
case conditions
when Array
case conditions[0]
when String # SQL
code << '[' + conditions.first.inspect
code << conditions[1..-1].collect { |p| ', ' + sanitize_condition(p) }.join if conditi... | ruby | def conditions_code
conditions = @table.options[:conditions]
code = ''
case conditions
when Array
case conditions[0]
when String # SQL
code << '[' + conditions.first.inspect
code << conditions[1..-1].collect { |p| ', ' + sanitize_condition(p) }.join if conditi... | [
"def",
"conditions_code",
"conditions",
"=",
"@table",
".",
"options",
"[",
":conditions",
"]",
"code",
"=",
"''",
"case",
"conditions",
"when",
"Array",
"case",
"conditions",
"[",
"0",
"]",
"when",
"String",
"# SQL",
"code",
"<<",
"'['",
"+",
"conditions",
... | Generate the code from a conditions option | [
"Generate",
"the",
"code",
"from",
"a",
"conditions",
"option"
] | 7d27d246ae6834af68eadcb567597bd78487d5fd | https://github.com/ekylibre/active_list/blob/7d27d246ae6834af68eadcb567597bd78487d5fd/lib/active_list/generator/finder.rb#L90-L120 |
21,277 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.default_load_paths | def default_load_paths
paths = []
# Check for Rails config path
paths << "#{::Rails.root}/config" if rails?
# Check for defined constants
paths << CONFIG_ROOT if defined?(CONFIG_ROOT) && Dir.exists?(CONFIG_ROOT)
paths << CONFIG_PATH if defined?(CONFIG_PATH) && Dir.exists?(CONFIG_PA... | ruby | def default_load_paths
paths = []
# Check for Rails config path
paths << "#{::Rails.root}/config" if rails?
# Check for defined constants
paths << CONFIG_ROOT if defined?(CONFIG_ROOT) && Dir.exists?(CONFIG_ROOT)
paths << CONFIG_PATH if defined?(CONFIG_PATH) && Dir.exists?(CONFIG_PA... | [
"def",
"default_load_paths",
"paths",
"=",
"[",
"]",
"# Check for Rails config path",
"paths",
"<<",
"\"#{::Rails.root}/config\"",
"if",
"rails?",
"# Check for defined constants",
"paths",
"<<",
"CONFIG_ROOT",
"if",
"defined?",
"(",
"CONFIG_ROOT",
")",
"&&",
"Dir",
".",... | Checks environment for default configuration load paths. Adds them to load paths if found. | [
"Checks",
"environment",
"for",
"default",
"configuration",
"load",
"paths",
".",
"Adds",
"them",
"to",
"load",
"paths",
"if",
"found",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L28-L43 |
21,278 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.read | def read(file, name, ext)
contents = File.read(file) # Read the contents from the file.
contents = ERB.new(contents).result # Evaluate any ruby code using ERB.
parse(contents, name, ext) # Parse the contents based on the file type
end | ruby | def read(file, name, ext)
contents = File.read(file) # Read the contents from the file.
contents = ERB.new(contents).result # Evaluate any ruby code using ERB.
parse(contents, name, ext) # Parse the contents based on the file type
end | [
"def",
"read",
"(",
"file",
",",
"name",
",",
"ext",
")",
"contents",
"=",
"File",
".",
"read",
"(",
"file",
")",
"# Read the contents from the file.",
"contents",
"=",
"ERB",
".",
"new",
"(",
"contents",
")",
".",
"result",
"# Evaluate any ruby code using ERB... | Reads and parses the config data from the specified file. | [
"Reads",
"and",
"parses",
"the",
"config",
"data",
"from",
"the",
"specified",
"file",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L78-L82 |
21,279 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.parse | def parse(contents, name, ext)
hash = case ext
when *YML_FILE_TYPES
YAML::load(contents)
when *XML_FILE_TYPES
parse_xml(contents, name)
when *CNF_FILE_TYPES
RConfig::PropertiesFile.parse(contents)
else
raise ConfigError, "Unknown File type: #... | ruby | def parse(contents, name, ext)
hash = case ext
when *YML_FILE_TYPES
YAML::load(contents)
when *XML_FILE_TYPES
parse_xml(contents, name)
when *CNF_FILE_TYPES
RConfig::PropertiesFile.parse(contents)
else
raise ConfigError, "Unknown File type: #... | [
"def",
"parse",
"(",
"contents",
",",
"name",
",",
"ext",
")",
"hash",
"=",
"case",
"ext",
"when",
"YML_FILE_TYPES",
"YAML",
"::",
"load",
"(",
"contents",
")",
"when",
"XML_FILE_TYPES",
"parse_xml",
"(",
"contents",
",",
"name",
")",
"when",
"CNF_FILE_TYP... | Parses contents of the config file based on file type.
XML files expect the root element to be the same as the
file name. | [
"Parses",
"contents",
"of",
"the",
"config",
"file",
"based",
"on",
"file",
"type",
".",
"XML",
"files",
"expect",
"the",
"root",
"element",
"to",
"be",
"the",
"same",
"as",
"the",
"file",
"name",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L89-L101 |
21,280 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.parse_xml | def parse_xml(contents, name)
hash = Hash.from_xml(contents)
hash = hash[name] if hash.size == 1 && hash.key?(name) # xml document could have root tag matching the file name.
RConfig::PropertiesFile.parse_references(hash)
end | ruby | def parse_xml(contents, name)
hash = Hash.from_xml(contents)
hash = hash[name] if hash.size == 1 && hash.key?(name) # xml document could have root tag matching the file name.
RConfig::PropertiesFile.parse_references(hash)
end | [
"def",
"parse_xml",
"(",
"contents",
",",
"name",
")",
"hash",
"=",
"Hash",
".",
"from_xml",
"(",
"contents",
")",
"hash",
"=",
"hash",
"[",
"name",
"]",
"if",
"hash",
".",
"size",
"==",
"1",
"&&",
"hash",
".",
"key?",
"(",
"name",
")",
"# xml docu... | Parses xml file and processes any references in the property values. | [
"Parses",
"xml",
"file",
"and",
"processes",
"any",
"references",
"in",
"the",
"property",
"values",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L105-L109 |
21,281 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.merge_hashes | def merge_hashes(hashes)
hashes.inject({}) { |n, h| n.weave(h, true) }
end | ruby | def merge_hashes(hashes)
hashes.inject({}) { |n, h| n.weave(h, true) }
end | [
"def",
"merge_hashes",
"(",
"hashes",
")",
"hashes",
".",
"inject",
"(",
"{",
"}",
")",
"{",
"|",
"n",
",",
"h",
"|",
"n",
".",
"weave",
"(",
"h",
",",
"true",
")",
"}",
"end"
] | Returns a merge of hashes. | [
"Returns",
"a",
"merge",
"of",
"hashes",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L114-L116 |
21,282 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.make_indifferent | def make_indifferent(hash)
case hash
when Hash
unless hash.frozen?
hash.each do |k, v|
hash[k] = make_indifferent(v)
end
hash = RConfig::Config.new.merge!(hash).freeze
end
logger.debug "make_indefferent: x = #{hash.inspect}:#{... | ruby | def make_indifferent(hash)
case hash
when Hash
unless hash.frozen?
hash.each do |k, v|
hash[k] = make_indifferent(v)
end
hash = RConfig::Config.new.merge!(hash).freeze
end
logger.debug "make_indefferent: x = #{hash.inspect}:#{... | [
"def",
"make_indifferent",
"(",
"hash",
")",
"case",
"hash",
"when",
"Hash",
"unless",
"hash",
".",
"frozen?",
"hash",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"hash",
"[",
"k",
"]",
"=",
"make_indifferent",
"(",
"v",
")",
"end",
"hash",
"=",
"R... | Recursively makes hashes into frozen IndifferentAccess Config Hash
Arrays are also traversed and frozen. | [
"Recursively",
"makes",
"hashes",
"into",
"frozen",
"IndifferentAccess",
"Config",
"Hash",
"Arrays",
"are",
"also",
"traversed",
"and",
"frozen",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L122-L144 |
21,283 | rahmal/rconfig | lib/rconfig/utils.rb | RConfig.Utils.flush_cache | def flush_cache(name=nil)
if name
name = name.to_s
self.cache_hash[name] &&= nil
else
logger.warn "RConfig: Flushing config data cache."
self.suffixes = {}
self.cache = {}
self.cache_files = {}
self.cache_hash = {}
sel... | ruby | def flush_cache(name=nil)
if name
name = name.to_s
self.cache_hash[name] &&= nil
else
logger.warn "RConfig: Flushing config data cache."
self.suffixes = {}
self.cache = {}
self.cache_files = {}
self.cache_hash = {}
sel... | [
"def",
"flush_cache",
"(",
"name",
"=",
"nil",
")",
"if",
"name",
"name",
"=",
"name",
".",
"to_s",
"self",
".",
"cache_hash",
"[",
"name",
"]",
"&&=",
"nil",
"else",
"logger",
".",
"warn",
"\"RConfig: Flushing config data cache.\"",
"self",
".",
"suffixes",... | If a config file name is specified, flushes cached config values
for specified config file. Otherwise, flushes all cached config data.
The latter should be avoided in production environments, if possible. | [
"If",
"a",
"config",
"file",
"name",
"is",
"specified",
"flushes",
"cached",
"config",
"values",
"for",
"specified",
"config",
"file",
".",
"Otherwise",
"flushes",
"all",
"cached",
"config",
"data",
".",
"The",
"latter",
"should",
"be",
"avoided",
"in",
"pro... | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/utils.rb#L150-L163 |
21,284 | rahmal/rconfig | lib/rconfig/cascade.rb | RConfig.Cascade.overlay= | def overlay=(value)
reload(false) if self.overlay != value
self.overlay = value && value.dup.freeze
end | ruby | def overlay=(value)
reload(false) if self.overlay != value
self.overlay = value && value.dup.freeze
end | [
"def",
"overlay",
"=",
"(",
"value",
")",
"reload",
"(",
"false",
")",
"if",
"self",
".",
"overlay",
"!=",
"value",
"self",
".",
"overlay",
"=",
"value",
"&&",
"value",
".",
"dup",
".",
"freeze",
"end"
] | Sets a custome overlay for | [
"Sets",
"a",
"custome",
"overlay",
"for"
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/cascade.rb#L7-L10 |
21,285 | rahmal/rconfig | lib/rconfig/cascade.rb | RConfig.Cascade.suffixes_for | def suffixes_for(name)
name = name.to_s
self.suffixes[name] ||= begin
ol = overlay
name_x = name.dup
if name_x.sub!(/_([A-Z]+)$/, '')
ol = $1
end
name_x.freeze
result = if ol
ol_ = ol.upcase
ol = ol.downcase
x = []
... | ruby | def suffixes_for(name)
name = name.to_s
self.suffixes[name] ||= begin
ol = overlay
name_x = name.dup
if name_x.sub!(/_([A-Z]+)$/, '')
ol = $1
end
name_x.freeze
result = if ol
ol_ = ol.upcase
ol = ol.downcase
x = []
... | [
"def",
"suffixes_for",
"(",
"name",
")",
"name",
"=",
"name",
".",
"to_s",
"self",
".",
"suffixes",
"[",
"name",
"]",
"||=",
"begin",
"ol",
"=",
"overlay",
"name_x",
"=",
"name",
".",
"dup",
"if",
"name_x",
".",
"sub!",
"(",
"/",
"/",
",",
"''",
... | Returns a list of suffixes to try for a given config name.
A config name with an explicit overlay (e.g.: 'name_GB')
overrides any current _overlay.
This allows code to specifically ask for config overlays
for a particular locale. | [
"Returns",
"a",
"list",
"of",
"suffixes",
"to",
"try",
"for",
"a",
"given",
"config",
"name",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/cascade.rb#L21-L53 |
21,286 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.load_config_files | def load_config_files(name, force=false)
name = name.to_s
# Return last config file hash list loaded,
# if reload is disabled and files have already been loaded.
return self.cache_config_files[name] if self.reload_disabled? && self.cache_config_files[name]
logger.info "Loading config fil... | ruby | def load_config_files(name, force=false)
name = name.to_s
# Return last config file hash list loaded,
# if reload is disabled and files have already been loaded.
return self.cache_config_files[name] if self.reload_disabled? && self.cache_config_files[name]
logger.info "Loading config fil... | [
"def",
"load_config_files",
"(",
"name",
",",
"force",
"=",
"false",
")",
"name",
"=",
"name",
".",
"to_s",
"# Return last config file hash list loaded,",
"# if reload is disabled and files have already been loaded.",
"return",
"self",
".",
"cache_config_files",
"[",
"name"... | Get each config file's yaml hash for the given config name,
to be merged later. Files will only be loaded if they have
not been loaded before or the files have changed within the
last five minutes, or force is explicitly set to true. | [
"Get",
"each",
"config",
"file",
"s",
"yaml",
"hash",
"for",
"the",
"given",
"config",
"name",
"to",
"be",
"merged",
"later",
".",
"Files",
"will",
"only",
"be",
"loaded",
"if",
"they",
"have",
"not",
"been",
"loaded",
"before",
"or",
"the",
"files",
"... | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L14-L81 |
21,287 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.config_changed? | def config_changed?(name)
logger.debug "config_changed?(#{name.inspect})"
name = name.to_s
!(self.cache_files[name] === get_config_files(name))
end | ruby | def config_changed?(name)
logger.debug "config_changed?(#{name.inspect})"
name = name.to_s
!(self.cache_files[name] === get_config_files(name))
end | [
"def",
"config_changed?",
"(",
"name",
")",
"logger",
".",
"debug",
"\"config_changed?(#{name.inspect})\"",
"name",
"=",
"name",
".",
"to_s",
"!",
"(",
"self",
".",
"cache_files",
"[",
"name",
"]",
"===",
"get_config_files",
"(",
"name",
")",
")",
"end"
] | Returns whether or not the config for the given config name has changed
since it was last loaded.
Returns true if any files for config have changes since
last load. | [
"Returns",
"whether",
"or",
"not",
"the",
"config",
"for",
"the",
"given",
"config",
"name",
"has",
"changed",
"since",
"it",
"was",
"last",
"loaded",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L131-L135 |
21,288 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.get_config_data | def get_config_data(name)
logger.debug "get_config_data(#{name.inspect})"
name = name.to_s
unless result = self.cache_hash[name]
result = self.cache_hash[name] =
make_indifferent(
merge_hashes(
load_config_files(name)
)
... | ruby | def get_config_data(name)
logger.debug "get_config_data(#{name.inspect})"
name = name.to_s
unless result = self.cache_hash[name]
result = self.cache_hash[name] =
make_indifferent(
merge_hashes(
load_config_files(name)
)
... | [
"def",
"get_config_data",
"(",
"name",
")",
"logger",
".",
"debug",
"\"get_config_data(#{name.inspect})\"",
"name",
"=",
"name",
".",
"to_s",
"unless",
"result",
"=",
"self",
".",
"cache_hash",
"[",
"name",
"]",
"result",
"=",
"self",
".",
"cache_hash",
"[",
... | Get the merged config hash for the named file.
Returns a cached indifferent access faker hash merged
from all config files for a name. | [
"Get",
"the",
"merged",
"config",
"hash",
"for",
"the",
"named",
"file",
".",
"Returns",
"a",
"cached",
"indifferent",
"access",
"faker",
"hash",
"merged",
"from",
"all",
"config",
"files",
"for",
"a",
"name",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L143-L158 |
21,289 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.check_for_changes | def check_for_changes(name=nil)
changed = []
if name == nil
self.cache_hash.keys.dup.each do |name|
if reload_on_change(name)
changed << name
end
end
else
name = name.to_s
if reload_on_change(name)
changed << name
end
... | ruby | def check_for_changes(name=nil)
changed = []
if name == nil
self.cache_hash.keys.dup.each do |name|
if reload_on_change(name)
changed << name
end
end
else
name = name.to_s
if reload_on_change(name)
changed << name
end
... | [
"def",
"check_for_changes",
"(",
"name",
"=",
"nil",
")",
"changed",
"=",
"[",
"]",
"if",
"name",
"==",
"nil",
"self",
".",
"cache_hash",
".",
"keys",
".",
"dup",
".",
"each",
"do",
"|",
"name",
"|",
"if",
"reload_on_change",
"(",
"name",
")",
"chang... | If name is specified, checks that file for changes and
reloads it if there are. Otherwise, checks all files
in the cache, reloading the changed files. | [
"If",
"name",
"is",
"specified",
"checks",
"that",
"file",
"for",
"changes",
"and",
"reloads",
"it",
"if",
"there",
"are",
".",
"Otherwise",
"checks",
"all",
"files",
"in",
"the",
"cache",
"reloading",
"the",
"changed",
"files",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L164-L180 |
21,290 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.reload_on_change | def reload_on_change(name)
logger.debug "reload_on_change(#{name.inspect}), reload_disabled=#{self.reload_disabled?}"
if changed = config_changed?(name) && reload?
if self.cache_hash[name]
flush_cache(name) # flush cached config values.
fire_on_load(name) # force on_load trigger... | ruby | def reload_on_change(name)
logger.debug "reload_on_change(#{name.inspect}), reload_disabled=#{self.reload_disabled?}"
if changed = config_changed?(name) && reload?
if self.cache_hash[name]
flush_cache(name) # flush cached config values.
fire_on_load(name) # force on_load trigger... | [
"def",
"reload_on_change",
"(",
"name",
")",
"logger",
".",
"debug",
"\"reload_on_change(#{name.inspect}), reload_disabled=#{self.reload_disabled?}\"",
"if",
"changed",
"=",
"config_changed?",
"(",
"name",
")",
"&&",
"reload?",
"if",
"self",
".",
"cache_hash",
"[",
"nam... | If config files have changed, caches are flushed, on_load triggers are run. | [
"If",
"config",
"files",
"have",
"changed",
"caches",
"are",
"flushed",
"on_load",
"triggers",
"are",
"run",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L184-L193 |
21,291 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.with_file | def with_file(name, *args)
logger.debug "with_file(#{name.inspect}, #{args.inspect})"
result = args.inject(config_for(name)) { |v, i|
logger.debug "v = #{v.inspect}, i = #{i.inspect}"
case v
when Hash
v[i.to_s]
when Array
i.is_a?(Integer) ? v[i] : ... | ruby | def with_file(name, *args)
logger.debug "with_file(#{name.inspect}, #{args.inspect})"
result = args.inject(config_for(name)) { |v, i|
logger.debug "v = #{v.inspect}, i = #{i.inspect}"
case v
when Hash
v[i.to_s]
when Array
i.is_a?(Integer) ? v[i] : ... | [
"def",
"with_file",
"(",
"name",
",",
"*",
"args",
")",
"logger",
".",
"debug",
"\"with_file(#{name.inspect}, #{args.inspect})\"",
"result",
"=",
"args",
".",
"inject",
"(",
"config_for",
"(",
"name",
")",
")",
"{",
"|",
"v",
",",
"i",
"|",
"logger",
".",
... | Get the value specified by the args, in the file specified by th name | [
"Get",
"the",
"value",
"specified",
"by",
"the",
"args",
"in",
"the",
"file",
"specified",
"by",
"th",
"name"
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L231-L246 |
21,292 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.config_for | def config_for(name)
name = name.to_s
check_for_changes(name) if auto_check?(name)
data = get_config_data(name)
logger.debug "config_for(#{name.inspect}) => #{data.inspect}"
data
end | ruby | def config_for(name)
name = name.to_s
check_for_changes(name) if auto_check?(name)
data = get_config_data(name)
logger.debug "config_for(#{name.inspect}) => #{data.inspect}"
data
end | [
"def",
"config_for",
"(",
"name",
")",
"name",
"=",
"name",
".",
"to_s",
"check_for_changes",
"(",
"name",
")",
"if",
"auto_check?",
"(",
"name",
")",
"data",
"=",
"get_config_data",
"(",
"name",
")",
"logger",
".",
"debug",
"\"config_for(#{name.inspect}) => #... | Get a hash of merged config data.
Will auto check every 5 minutes, for longer running apps, unless reload is disabled. | [
"Get",
"a",
"hash",
"of",
"merged",
"config",
"data",
".",
"Will",
"auto",
"check",
"every",
"5",
"minutes",
"for",
"longer",
"running",
"apps",
"unless",
"reload",
"is",
"disabled",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L252-L258 |
21,293 | rahmal/rconfig | lib/rconfig/core_methods.rb | RConfig.CoreMethods.method_missing | def method_missing(method, * args)
value = with_file(method, * args)
logger.debug "#{self}.method_missing(#{method.inspect}, #{args.inspect}) => #{value.inspect}"
value
end | ruby | def method_missing(method, * args)
value = with_file(method, * args)
logger.debug "#{self}.method_missing(#{method.inspect}, #{args.inspect}) => #{value.inspect}"
value
end | [
"def",
"method_missing",
"(",
"method",
",",
"*",
"args",
")",
"value",
"=",
"with_file",
"(",
"method",
",",
"args",
")",
"logger",
".",
"debug",
"\"#{self}.method_missing(#{method.inspect}, #{args.inspect}) => #{value.inspect}\"",
"value",
"end"
] | Short-hand access to config file by its name.
Example:
RConfig.provider(:foo) => RConfig.with_file(:provider).foo
RConfig.provider.foo => RConfig.with_file(:provider).foo | [
"Short",
"-",
"hand",
"access",
"to",
"config",
"file",
"by",
"its",
"name",
"."
] | 528c2fca29fcba4eb495ae443fa04269278d226b | https://github.com/rahmal/rconfig/blob/528c2fca29fcba4eb495ae443fa04269278d226b/lib/rconfig/core_methods.rb#L268-L272 |
21,294 | propublica/simpler-tiles | lib/simpler_tiles/layer/vector_layer.rb | SimplerTiles.VectorLayer.query | def query(sql, &blk)
layer = SimplerTiles::Query.new(sql, &blk)
add_query layer
end | ruby | def query(sql, &blk)
layer = SimplerTiles::Query.new(sql, &blk)
add_query layer
end | [
"def",
"query",
"(",
"sql",
",",
"&",
"blk",
")",
"layer",
"=",
"SimplerTiles",
"::",
"Query",
".",
"new",
"(",
"sql",
",",
"blk",
")",
"add_query",
"layer",
"end"
] | Add a query to this Layer's c list. | [
"Add",
"a",
"query",
"to",
"this",
"Layer",
"s",
"c",
"list",
"."
] | 9d00f769102acbed02d30429598408c487d6c663 | https://github.com/propublica/simpler-tiles/blob/9d00f769102acbed02d30429598408c487d6c663/lib/simpler_tiles/layer/vector_layer.rb#L13-L16 |
21,295 | propublica/simpler-tiles | lib/simpler_tiles/map.rb | SimplerTiles.Map.layer | def layer(source, &blk)
layer = SimplerTiles::VectorLayer.new(source, &blk)
add_vector_layer layer
end | ruby | def layer(source, &blk)
layer = SimplerTiles::VectorLayer.new(source, &blk)
add_vector_layer layer
end | [
"def",
"layer",
"(",
"source",
",",
"&",
"blk",
")",
"layer",
"=",
"SimplerTiles",
"::",
"VectorLayer",
".",
"new",
"(",
"source",
",",
"blk",
")",
"add_vector_layer",
"layer",
"end"
] | Add a layer to the c list of layers and yield the new layer. | [
"Add",
"a",
"layer",
"to",
"the",
"c",
"list",
"of",
"layers",
"and",
"yield",
"the",
"new",
"layer",
"."
] | 9d00f769102acbed02d30429598408c487d6c663 | https://github.com/propublica/simpler-tiles/blob/9d00f769102acbed02d30429598408c487d6c663/lib/simpler_tiles/map.rb#L13-L16 |
21,296 | propublica/simpler-tiles | lib/simpler_tiles/map.rb | SimplerTiles.Map.raster_layer | def raster_layer(source, &blk)
layer = SimplerTiles::RasterLayer.new(source, &blk)
add_raster_layer layer
end | ruby | def raster_layer(source, &blk)
layer = SimplerTiles::RasterLayer.new(source, &blk)
add_raster_layer layer
end | [
"def",
"raster_layer",
"(",
"source",
",",
"&",
"blk",
")",
"layer",
"=",
"SimplerTiles",
"::",
"RasterLayer",
".",
"new",
"(",
"source",
",",
"blk",
")",
"add_raster_layer",
"layer",
"end"
] | Add a raster layer | [
"Add",
"a",
"raster",
"layer"
] | 9d00f769102acbed02d30429598408c487d6c663 | https://github.com/propublica/simpler-tiles/blob/9d00f769102acbed02d30429598408c487d6c663/lib/simpler_tiles/map.rb#L19-L22 |
21,297 | propublica/simpler-tiles | lib/simpler_tiles/map.rb | SimplerTiles.Map.ar_layer | def ar_layer(&blk)
if !defined?(ActiveRecord)
raise "ActiveRecord not available"
end
config = ActiveRecord::Base.connection.instance_variable_get("@config")
params = {
:dbname => config[:database],
:user => config[:username],
:host => config[:host],
... | ruby | def ar_layer(&blk)
if !defined?(ActiveRecord)
raise "ActiveRecord not available"
end
config = ActiveRecord::Base.connection.instance_variable_get("@config")
params = {
:dbname => config[:database],
:user => config[:username],
:host => config[:host],
... | [
"def",
"ar_layer",
"(",
"&",
"blk",
")",
"if",
"!",
"defined?",
"(",
"ActiveRecord",
")",
"raise",
"\"ActiveRecord not available\"",
"end",
"config",
"=",
"ActiveRecord",
"::",
"Base",
".",
"connection",
".",
"instance_variable_get",
"(",
"\"@config\"",
")",
"pa... | A convienence method to use Active Record configuration and add a new
layer. | [
"A",
"convienence",
"method",
"to",
"use",
"Active",
"Record",
"configuration",
"and",
"add",
"a",
"new",
"layer",
"."
] | 9d00f769102acbed02d30429598408c487d6c663 | https://github.com/propublica/simpler-tiles/blob/9d00f769102acbed02d30429598408c487d6c663/lib/simpler_tiles/map.rb#L26-L43 |
21,298 | propublica/simpler-tiles | lib/simpler_tiles/map.rb | SimplerTiles.Map.to_png | def to_png
data = ""
to_png_stream Proc.new { |chunk| data += chunk }
yield data if block_given?
data
end | ruby | def to_png
data = ""
to_png_stream Proc.new { |chunk| data += chunk }
yield data if block_given?
data
end | [
"def",
"to_png",
"data",
"=",
"\"\"",
"to_png_stream",
"Proc",
".",
"new",
"{",
"|",
"chunk",
"|",
"data",
"+=",
"chunk",
"}",
"yield",
"data",
"if",
"block_given?",
"data",
"end"
] | Render the data to a blob of png data. | [
"Render",
"the",
"data",
"to",
"a",
"blob",
"of",
"png",
"data",
"."
] | 9d00f769102acbed02d30429598408c487d6c663 | https://github.com/propublica/simpler-tiles/blob/9d00f769102acbed02d30429598408c487d6c663/lib/simpler_tiles/map.rb#L46-L51 |
21,299 | propublica/simpler-tiles | lib/simpler_tiles/query.rb | SimplerTiles.Query.styles | def styles(styles)
styles.each do |k,v|
style = SimplerTiles::Style.new k, v
add_style style
end
end | ruby | def styles(styles)
styles.each do |k,v|
style = SimplerTiles::Style.new k, v
add_style style
end
end | [
"def",
"styles",
"(",
"styles",
")",
"styles",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"style",
"=",
"SimplerTiles",
"::",
"Style",
".",
"new",
"k",
",",
"v",
"add_style",
"style",
"end",
"end"
] | Initialize a query with a string containing OGR SQL.
Styles will take a hash of style declarations and adds them to the internal
c list. | [
"Initialize",
"a",
"query",
"with",
"a",
"string",
"containing",
"OGR",
"SQL",
".",
"Styles",
"will",
"take",
"a",
"hash",
"of",
"style",
"declarations",
"and",
"adds",
"them",
"to",
"the",
"internal",
"c",
"list",
"."
] | 9d00f769102acbed02d30429598408c487d6c663 | https://github.com/propublica/simpler-tiles/blob/9d00f769102acbed02d30429598408c487d6c663/lib/simpler_tiles/query.rb#L15-L20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.