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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,300 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/templater-1.0.0/lib/templater/generator.rb | Templater.Generator.actions | def actions(type=nil)
actions = type ? self.class.actions[type] : self.class.actions.values.flatten
actions.inject([]) do |actions, description|
actions << description.compile(self) if match_options?(description.options)
actions
end
end | ruby | def actions(type=nil)
actions = type ? self.class.actions[type] : self.class.actions.values.flatten
actions.inject([]) do |actions, description|
actions << description.compile(self) if match_options?(description.options)
actions
end
end | [
"def",
"actions",
"(",
"type",
"=",
"nil",
")",
"actions",
"=",
"type",
"?",
"self",
".",
"class",
".",
"actions",
"[",
"type",
"]",
":",
"self",
".",
"class",
".",
"actions",
".",
"values",
".",
"flatten",
"actions",
".",
"inject",
"(",
"[",
"]",
... | Finds and returns all templates and files for this generators whose options match its options.
=== Parameters
type<Symbol>:: The type of actions to look up (optional)
=== Returns
[Templater::Actions::*]:: The found templates and files. | [
"Finds",
"and",
"returns",
"all",
"templates",
"and",
"files",
"for",
"this",
"generators",
"whose",
"options",
"match",
"its",
"options",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/templater-1.0.0/lib/templater/generator.rb#L548-L554 |
17,301 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/templater-1.0.0/lib/templater/generator.rb | Templater.Generator.all_actions | def all_actions(type=nil)
all_actions = actions(type)
all_actions += invocations.map { |i| i.all_actions(type) }
all_actions.flatten
end | ruby | def all_actions(type=nil)
all_actions = actions(type)
all_actions += invocations.map { |i| i.all_actions(type) }
all_actions.flatten
end | [
"def",
"all_actions",
"(",
"type",
"=",
"nil",
")",
"all_actions",
"=",
"actions",
"(",
"type",
")",
"all_actions",
"+=",
"invocations",
".",
"map",
"{",
"|",
"i",
"|",
"i",
".",
"all_actions",
"(",
"type",
")",
"}",
"all_actions",
".",
"flatten",
"end... | Finds and returns all templates and files for this generators and any of those generators it invokes,
whose options match that generator's options.
=== Returns
[Templater::Actions::File, Templater::Actions::Template]:: The found templates and files. | [
"Finds",
"and",
"returns",
"all",
"templates",
"and",
"files",
"for",
"this",
"generators",
"and",
"any",
"of",
"those",
"generators",
"it",
"invokes",
"whose",
"options",
"match",
"that",
"generator",
"s",
"options",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/templater-1.0.0/lib/templater/generator.rb#L561-L565 |
17,302 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/ssl.rb | WEBrick.Utils.create_self_signed_cert | def create_self_signed_cert(bits, cn, comment)
rsa = OpenSSL::PKey::RSA.new(bits){|p, n|
case p
when 0; $stderr.putc "." # BN_generate_prime
when 1; $stderr.putc "+" # BN_generate_prime
when 2; $stderr.putc "*" # searching good prime,
# n = #of ... | ruby | def create_self_signed_cert(bits, cn, comment)
rsa = OpenSSL::PKey::RSA.new(bits){|p, n|
case p
when 0; $stderr.putc "." # BN_generate_prime
when 1; $stderr.putc "+" # BN_generate_prime
when 2; $stderr.putc "*" # searching good prime,
# n = #of ... | [
"def",
"create_self_signed_cert",
"(",
"bits",
",",
"cn",
",",
"comment",
")",
"rsa",
"=",
"OpenSSL",
"::",
"PKey",
"::",
"RSA",
".",
"new",
"(",
"bits",
")",
"{",
"|",
"p",
",",
"n",
"|",
"case",
"p",
"when",
"0",
";",
"$stderr",
".",
"putc",
"\... | Creates a self-signed certificate with the given number of +bits+,
the issuer +cn+ and a +comment+ to be stored in the certificate. | [
"Creates",
"a",
"self",
"-",
"signed",
"certificate",
"with",
"the",
"given",
"number",
"of",
"+",
"bits",
"+",
"the",
"issuer",
"+",
"cn",
"+",
"and",
"a",
"+",
"comment",
"+",
"to",
"be",
"stored",
"in",
"the",
"certificate",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/ssl.rb#L91-L129 |
17,303 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/ssl.rb | WEBrick.GenericServer.listen | def listen(address, port) # :nodoc:
listeners = Utils::create_listeners(address, port, @logger)
if @config[:SSLEnable]
unless ssl_context
@ssl_context = setup_ssl_context(@config)
@logger.info("\n" + @config[:SSLCertificate].to_text)
end
listeners.collect!{|svr|
... | ruby | def listen(address, port) # :nodoc:
listeners = Utils::create_listeners(address, port, @logger)
if @config[:SSLEnable]
unless ssl_context
@ssl_context = setup_ssl_context(@config)
@logger.info("\n" + @config[:SSLCertificate].to_text)
end
listeners.collect!{|svr|
... | [
"def",
"listen",
"(",
"address",
",",
"port",
")",
"# :nodoc:",
"listeners",
"=",
"Utils",
"::",
"create_listeners",
"(",
"address",
",",
"port",
",",
"@logger",
")",
"if",
"@config",
"[",
":SSLEnable",
"]",
"unless",
"ssl_context",
"@ssl_context",
"=",
"set... | Updates +listen+ to enable SSL when the SSL configuration is active. | [
"Updates",
"+",
"listen",
"+",
"to",
"enable",
"SSL",
"when",
"the",
"SSL",
"configuration",
"is",
"active",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/ssl.rb#L151-L165 |
17,304 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/extlib-0.9.16/lib/extlib/logger.rb | Extlib.Logger.initialize_log | def initialize_log(log)
close if @log # be sure that we don't leave open files laying around.
if log.respond_to?(:write)
@log = log
elsif File.exist?(log)
@log = open(log, (File::WRONLY | File::APPEND))
@log.sync = true
else
FileUtils.mkdir_p(File.dirname(log)) u... | ruby | def initialize_log(log)
close if @log # be sure that we don't leave open files laying around.
if log.respond_to?(:write)
@log = log
elsif File.exist?(log)
@log = open(log, (File::WRONLY | File::APPEND))
@log.sync = true
else
FileUtils.mkdir_p(File.dirname(log)) u... | [
"def",
"initialize_log",
"(",
"log",
")",
"close",
"if",
"@log",
"# be sure that we don't leave open files laying around.",
"if",
"log",
".",
"respond_to?",
"(",
":write",
")",
"@log",
"=",
"log",
"elsif",
"File",
".",
"exist?",
"(",
"log",
")",
"@log",
"=",
"... | Readies a log for writing.
==== Parameters
log<IO, String>:: Either an IO object or a name of a logfile. | [
"Readies",
"a",
"log",
"for",
"writing",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/extlib-0.9.16/lib/extlib/logger.rb#L71-L85 |
17,305 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/extlib-0.9.16/lib/extlib/logger.rb | Extlib.Logger.<< | def <<(string = nil)
message = ""
message << delimiter
message << string if string
message << "\n" unless message[-1] == ?\n
@buffer << message
flush if @auto_flush
message
end | ruby | def <<(string = nil)
message = ""
message << delimiter
message << string if string
message << "\n" unless message[-1] == ?\n
@buffer << message
flush if @auto_flush
message
end | [
"def",
"<<",
"(",
"string",
"=",
"nil",
")",
"message",
"=",
"\"\"",
"message",
"<<",
"delimiter",
"message",
"<<",
"string",
"if",
"string",
"message",
"<<",
"\"\\n\"",
"unless",
"message",
"[",
"-",
"1",
"]",
"==",
"?\\n",
"@buffer",
"<<",
"message",
... | Appends a message to the log. The methods yield to an optional block and
the output of this block will be appended to the message.
==== Parameters
string<String>:: The message to be logged. Defaults to nil.
==== Returns
String:: The resulting message added to the log file. | [
"Appends",
"a",
"message",
"to",
"the",
"log",
".",
"The",
"methods",
"yield",
"to",
"an",
"optional",
"block",
"and",
"the",
"output",
"of",
"this",
"block",
"will",
"be",
"appended",
"to",
"the",
"message",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/extlib-0.9.16/lib/extlib/logger.rb#L144-L153 |
17,306 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/net/telnet.rb | Net.Telnet.write | def write(string)
length = string.length
while 0 < length
IO::select(nil, [@sock])
@dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log")
length -= @sock.syswrite(string[-length..-1])
end
end | ruby | def write(string)
length = string.length
while 0 < length
IO::select(nil, [@sock])
@dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log")
length -= @sock.syswrite(string[-length..-1])
end
end | [
"def",
"write",
"(",
"string",
")",
"length",
"=",
"string",
".",
"length",
"while",
"0",
"<",
"length",
"IO",
"::",
"select",
"(",
"nil",
",",
"[",
"@sock",
"]",
")",
"@dumplog",
".",
"log_dump",
"(",
"'>'",
",",
"string",
"[",
"-",
"length",
".."... | Write +string+ to the host.
Does not perform any conversions on +string+. Will log +string+ to the
dumplog, if the Dump_log option is set. | [
"Write",
"+",
"string",
"+",
"to",
"the",
"host",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/net/telnet.rb#L610-L617 |
17,307 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/net/telnet.rb | Net.Telnet.cmd | def cmd(options) # :yield: recvdata
match = @options["Prompt"]
time_out = @options["Timeout"]
fail_eof = @options["FailEOF"]
if options.kind_of?(Hash)
string = options["String"]
match = options["Match"] if options.has_key?("Match")
time_out = options["Timeout"]... | ruby | def cmd(options) # :yield: recvdata
match = @options["Prompt"]
time_out = @options["Timeout"]
fail_eof = @options["FailEOF"]
if options.kind_of?(Hash)
string = options["String"]
match = options["Match"] if options.has_key?("Match")
time_out = options["Timeout"]... | [
"def",
"cmd",
"(",
"options",
")",
"# :yield: recvdata",
"match",
"=",
"@options",
"[",
"\"Prompt\"",
"]",
"time_out",
"=",
"@options",
"[",
"\"Timeout\"",
"]",
"fail_eof",
"=",
"@options",
"[",
"\"FailEOF\"",
"]",
"if",
"options",
".",
"kind_of?",
"(",
"Has... | Send a command to the host.
More exactly, sends a string to the host, and reads in all received
data until is sees the prompt or other matched sequence.
If a block is given, the received data will be yielded to it as
it is read in. Whether a block is given or not, the received data
will be return as a string. ... | [
"Send",
"a",
"command",
"to",
"the",
"host",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/net/telnet.rb#L678-L698 |
17,308 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/net/telnet.rb | Net.Telnet.login | def login(options, password = nil) # :yield: recvdata
login_prompt = /[Ll]ogin[: ]*\z/n
password_prompt = /[Pp]ass(?:word|phrase)[: ]*\z/n
if options.kind_of?(Hash)
username = options["Name"]
password = options["Password"]
login_prompt = options["LoginPrompt"] if options["Login... | ruby | def login(options, password = nil) # :yield: recvdata
login_prompt = /[Ll]ogin[: ]*\z/n
password_prompt = /[Pp]ass(?:word|phrase)[: ]*\z/n
if options.kind_of?(Hash)
username = options["Name"]
password = options["Password"]
login_prompt = options["LoginPrompt"] if options["Login... | [
"def",
"login",
"(",
"options",
",",
"password",
"=",
"nil",
")",
"# :yield: recvdata",
"login_prompt",
"=",
"/",
"\\z",
"/n",
"password_prompt",
"=",
"/",
"\\z",
"/n",
"if",
"options",
".",
"kind_of?",
"(",
"Hash",
")",
"username",
"=",
"options",
"[",
... | Login to the host with a given username and password.
The username and password can either be provided as two string
arguments in that order, or as a hash with keys "Name" and
"Password".
This method looks for the strings "login" and "Password" from the
host to determine when to send the username and password. ... | [
"Login",
"to",
"the",
"host",
"with",
"a",
"given",
"username",
"and",
"password",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/net/telnet.rb#L722-L754 |
17,309 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb | WEBrick.HTTPUtils.normalize_path | def normalize_path(path)
raise "abnormal path `#{path}'" if path[0] != ?/
ret = path.dup
ret.gsub!(%r{/+}o, '/') # // => /
while ret.sub!(%r'/\.(?:/|\Z)', '/'); end # /. => /
while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo
... | ruby | def normalize_path(path)
raise "abnormal path `#{path}'" if path[0] != ?/
ret = path.dup
ret.gsub!(%r{/+}o, '/') # // => /
while ret.sub!(%r'/\.(?:/|\Z)', '/'); end # /. => /
while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo
... | [
"def",
"normalize_path",
"(",
"path",
")",
"raise",
"\"abnormal path `#{path}'\"",
"if",
"path",
"[",
"0",
"]",
"!=",
"?/",
"ret",
"=",
"path",
".",
"dup",
"ret",
".",
"gsub!",
"(",
"%r{",
"}o",
",",
"'/'",
")",
"# // => /",
"while",
"ret",
".",
"... | Normalizes a request path. Raises an exception if the path cannot be
normalized. | [
"Normalizes",
"a",
"request",
"path",
".",
"Raises",
"an",
"exception",
"if",
"the",
"path",
"cannot",
"be",
"normalized",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb#L30-L40 |
17,310 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb | WEBrick.HTTPUtils.load_mime_types | def load_mime_types(file)
open(file){ |io|
hash = Hash.new
io.each{ |line|
next if /^#/ =~ line
line.chomp!
mimetype, ext0 = line.split(/\s+/, 2)
next unless ext0
next if ext0.empty?
ext0.split(/\s+/).each{ |ext| hash[ext] = mimetype }
... | ruby | def load_mime_types(file)
open(file){ |io|
hash = Hash.new
io.each{ |line|
next if /^#/ =~ line
line.chomp!
mimetype, ext0 = line.split(/\s+/, 2)
next unless ext0
next if ext0.empty?
ext0.split(/\s+/).each{ |ext| hash[ext] = mimetype }
... | [
"def",
"load_mime_types",
"(",
"file",
")",
"open",
"(",
"file",
")",
"{",
"|",
"io",
"|",
"hash",
"=",
"Hash",
".",
"new",
"io",
".",
"each",
"{",
"|",
"line",
"|",
"next",
"if",
"/",
"/",
"=~",
"line",
"line",
".",
"chomp!",
"mimetype",
",",
... | Loads Apache-compatible mime.types in +file+. | [
"Loads",
"Apache",
"-",
"compatible",
"mime",
".",
"types",
"in",
"+",
"file",
"+",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb#L108-L121 |
17,311 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb | WEBrick.HTTPUtils.parse_range_header | def parse_range_header(ranges_specifier)
if /^bytes=(.*)/ =~ ranges_specifier
byte_range_set = split_header_value($1)
byte_range_set.collect{|range_spec|
case range_spec
when /^(\d+)-(\d+)/ then $1.to_i .. $2.to_i
when /^(\d+)-/ then $1.to_i .. -1
when ... | ruby | def parse_range_header(ranges_specifier)
if /^bytes=(.*)/ =~ ranges_specifier
byte_range_set = split_header_value($1)
byte_range_set.collect{|range_spec|
case range_spec
when /^(\d+)-(\d+)/ then $1.to_i .. $2.to_i
when /^(\d+)-/ then $1.to_i .. -1
when ... | [
"def",
"parse_range_header",
"(",
"ranges_specifier",
")",
"if",
"/",
"/",
"=~",
"ranges_specifier",
"byte_range_set",
"=",
"split_header_value",
"(",
"$1",
")",
"byte_range_set",
".",
"collect",
"{",
"|",
"range_spec",
"|",
"case",
"range_spec",
"when",
"/",
"\... | Parses a Range header value +ranges_specifier+ | [
"Parses",
"a",
"Range",
"header",
"value",
"+",
"ranges_specifier",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb#L181-L193 |
17,312 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb | WEBrick.HTTPUtils.parse_qvalues | def parse_qvalues(value)
tmp = []
if value
parts = value.split(/,\s*/)
parts.each {|part|
if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
val = m[1]
q = (m[2] or 1).to_f
tmp.push([val, q])
end
}
tmp = tmp.s... | ruby | def parse_qvalues(value)
tmp = []
if value
parts = value.split(/,\s*/)
parts.each {|part|
if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
val = m[1]
q = (m[2] or 1).to_f
tmp.push([val, q])
end
}
tmp = tmp.s... | [
"def",
"parse_qvalues",
"(",
"value",
")",
"tmp",
"=",
"[",
"]",
"if",
"value",
"parts",
"=",
"value",
".",
"split",
"(",
"/",
"\\s",
"/",
")",
"parts",
".",
"each",
"{",
"|",
"part",
"|",
"if",
"m",
"=",
"%r{",
"\\s",
"\\s",
"\\d",
"\\.",
"\\d... | Parses q values in +value+ as used in Accept headers. | [
"Parses",
"q",
"values",
"in",
"+",
"value",
"+",
"as",
"used",
"in",
"Accept",
"headers",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb#L199-L214 |
17,313 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb | WEBrick.HTTPUtils.parse_query | def parse_query(str)
query = Hash.new
if str
str.split(/[&;]/).each{|x|
next if x.empty?
key, val = x.split(/=/,2)
key = unescape_form(key)
val = unescape_form(val.to_s)
val = FormData.new(val)
val.name = key
if query.has_key?(key... | ruby | def parse_query(str)
query = Hash.new
if str
str.split(/[&;]/).each{|x|
next if x.empty?
key, val = x.split(/=/,2)
key = unescape_form(key)
val = unescape_form(val.to_s)
val = FormData.new(val)
val.name = key
if query.has_key?(key... | [
"def",
"parse_query",
"(",
"str",
")",
"query",
"=",
"Hash",
".",
"new",
"if",
"str",
"str",
".",
"split",
"(",
"/",
"/",
")",
".",
"each",
"{",
"|",
"x",
"|",
"next",
"if",
"x",
".",
"empty?",
"key",
",",
"val",
"=",
"x",
".",
"split",
"(",
... | Parses the query component of a URI in +str+ | [
"Parses",
"the",
"query",
"component",
"of",
"a",
"URI",
"in",
"+",
"str",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb#L368-L386 |
17,314 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb | WEBrick.HTTPUtils.escape_path | def escape_path(str)
result = ""
str.scan(%r{/([^/]*)}).each{|i|
result << "/" << _escape(i[0], UNESCAPED_PCHAR)
}
return result
end | ruby | def escape_path(str)
result = ""
str.scan(%r{/([^/]*)}).each{|i|
result << "/" << _escape(i[0], UNESCAPED_PCHAR)
}
return result
end | [
"def",
"escape_path",
"(",
"str",
")",
"result",
"=",
"\"\"",
"str",
".",
"scan",
"(",
"%r{",
"}",
")",
".",
"each",
"{",
"|",
"i",
"|",
"result",
"<<",
"\"/\"",
"<<",
"_escape",
"(",
"i",
"[",
"0",
"]",
",",
"UNESCAPED_PCHAR",
")",
"}",
"return"... | Escapes path +str+ | [
"Escapes",
"path",
"+",
"str",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httputils.rb#L494-L500 |
17,315 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/file_list.rb | Rake.FileList.partition | def partition(&block) # :nodoc:
resolve
result = @items.partition(&block)
[
FileList.new.import(result[0]),
FileList.new.import(result[1]),
]
end | ruby | def partition(&block) # :nodoc:
resolve
result = @items.partition(&block)
[
FileList.new.import(result[0]),
FileList.new.import(result[1]),
]
end | [
"def",
"partition",
"(",
"&",
"block",
")",
"# :nodoc:",
"resolve",
"result",
"=",
"@items",
".",
"partition",
"(",
"block",
")",
"[",
"FileList",
".",
"new",
".",
"import",
"(",
"result",
"[",
"0",
"]",
")",
",",
"FileList",
".",
"new",
".",
"import... | FileList version of partition. Needed because the nested arrays should
be FileLists in this version. | [
"FileList",
"version",
"of",
"partition",
".",
"Needed",
"because",
"the",
"nested",
"arrays",
"should",
"be",
"FileLists",
"in",
"this",
"version",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/file_list.rb#L326-L333 |
17,316 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/file_list.rb | Rake.FileList.add_matching | def add_matching(pattern)
FileList.glob(pattern).each do |fn|
self << fn unless excluded_from_list?(fn)
end
end | ruby | def add_matching(pattern)
FileList.glob(pattern).each do |fn|
self << fn unless excluded_from_list?(fn)
end
end | [
"def",
"add_matching",
"(",
"pattern",
")",
"FileList",
".",
"glob",
"(",
"pattern",
")",
".",
"each",
"do",
"|",
"fn",
"|",
"self",
"<<",
"fn",
"unless",
"excluded_from_list?",
"(",
"fn",
")",
"end",
"end"
] | Add matching glob patterns. | [
"Add",
"matching",
"glob",
"patterns",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/file_list.rb#L342-L346 |
17,317 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/promise.rb | Rake.Promise.value | def value
unless complete?
stat :sleeping_on, :item_id => object_id
@mutex.synchronize do
stat :has_lock_on, :item_id => object_id
chore
stat :releasing_lock_on, :item_id => object_id
end
end
error? ? raise(@error) : @result
end | ruby | def value
unless complete?
stat :sleeping_on, :item_id => object_id
@mutex.synchronize do
stat :has_lock_on, :item_id => object_id
chore
stat :releasing_lock_on, :item_id => object_id
end
end
error? ? raise(@error) : @result
end | [
"def",
"value",
"unless",
"complete?",
"stat",
":sleeping_on",
",",
":item_id",
"=>",
"object_id",
"@mutex",
".",
"synchronize",
"do",
"stat",
":has_lock_on",
",",
":item_id",
"=>",
"object_id",
"chore",
"stat",
":releasing_lock_on",
",",
":item_id",
"=>",
"object... | Create a promise to do the chore specified by the block.
Return the value of this promise.
If the promised chore is not yet complete, then do the work
synchronously. We will wait. | [
"Create",
"a",
"promise",
"to",
"do",
"the",
"chore",
"specified",
"by",
"the",
"block",
".",
"Return",
"the",
"value",
"of",
"this",
"promise",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/promise.rb#L28-L38 |
17,318 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/promise.rb | Rake.Promise.chore | def chore
if complete?
stat :found_completed, :item_id => object_id
return
end
stat :will_execute, :item_id => object_id
begin
@result = @block.call(*@args)
rescue Exception => e
@error = e
end
stat :did_execute, :item_id => object_id
disca... | ruby | def chore
if complete?
stat :found_completed, :item_id => object_id
return
end
stat :will_execute, :item_id => object_id
begin
@result = @block.call(*@args)
rescue Exception => e
@error = e
end
stat :did_execute, :item_id => object_id
disca... | [
"def",
"chore",
"if",
"complete?",
"stat",
":found_completed",
",",
":item_id",
"=>",
"object_id",
"return",
"end",
"stat",
":will_execute",
",",
":item_id",
"=>",
"object_id",
"begin",
"@result",
"=",
"@block",
".",
"call",
"(",
"@args",
")",
"rescue",
"Excep... | Perform the chore promised | [
"Perform",
"the",
"chore",
"promised"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/promise.rb#L56-L69 |
17,319 | rhomobile/rhodes | lib/extensions/net-http/net/http.rb | Net.HTTPHeader.[]= | def []=(key, val)
unless val
@header.delete key.downcase
return val
end
@header[key.downcase] = [val]
end | ruby | def []=(key, val)
unless val
@header.delete key.downcase
return val
end
@header[key.downcase] = [val]
end | [
"def",
"[]=",
"(",
"key",
",",
"val",
")",
"unless",
"val",
"@header",
".",
"delete",
"key",
".",
"downcase",
"return",
"val",
"end",
"@header",
"[",
"key",
".",
"downcase",
"]",
"=",
"[",
"val",
"]",
"end"
] | Sets the header field corresponding to the case-insensitive key. | [
"Sets",
"the",
"header",
"field",
"corresponding",
"to",
"the",
"case",
"-",
"insensitive",
"key",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/lib/extensions/net-http/net/http.rb#L1346-L1352 |
17,320 | rhomobile/rhodes | lib/extensions/net-http/net/http.rb | Net.HTTPHeader.each_header | def each_header #:yield: +key+, +value+
block_given? or return enum_for(__method__)
@header.each do |k,va|
yield k, va.join(', ')
end
end | ruby | def each_header #:yield: +key+, +value+
block_given? or return enum_for(__method__)
@header.each do |k,va|
yield k, va.join(', ')
end
end | [
"def",
"each_header",
"#:yield: +key+, +value+",
"block_given?",
"or",
"return",
"enum_for",
"(",
"__method__",
")",
"@header",
".",
"each",
"do",
"|",
"k",
",",
"va",
"|",
"yield",
"k",
",",
"va",
".",
"join",
"(",
"', '",
")",
"end",
"end"
] | Iterates for each header names and values. | [
"Iterates",
"for",
"each",
"header",
"names",
"and",
"values",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/lib/extensions/net-http/net/http.rb#L1403-L1408 |
17,321 | rhomobile/rhodes | lib/extensions/net-http/net/http.rb | Net.HTTPResponse.read_body | def read_body(dest = nil, &block)
if @read
raise IOError, "#{self.class}\#read_body called twice" if dest or block
return @body
end
to = procdest(dest, block)
stream_check
if @body_exist
read_body_0 to
@body = to
else
@body = nil
end
... | ruby | def read_body(dest = nil, &block)
if @read
raise IOError, "#{self.class}\#read_body called twice" if dest or block
return @body
end
to = procdest(dest, block)
stream_check
if @body_exist
read_body_0 to
@body = to
else
@body = nil
end
... | [
"def",
"read_body",
"(",
"dest",
"=",
"nil",
",",
"&",
"block",
")",
"if",
"@read",
"raise",
"IOError",
",",
"\"#{self.class}\\#read_body called twice\"",
"if",
"dest",
"or",
"block",
"return",
"@body",
"end",
"to",
"=",
"procdest",
"(",
"dest",
",",
"block"... | Gets entity body. If the block given, yields it to +block+.
The body is provided in fragments, as it is read in from the socket.
Calling this method a second or subsequent time will return the
already read string.
http.request_get('/index.html') {|res|
puts res.read_body
}
http.request_get('/index.... | [
"Gets",
"entity",
"body",
".",
"If",
"the",
"block",
"given",
"yields",
"it",
"to",
"+",
"block",
"+",
".",
"The",
"body",
"is",
"provided",
"in",
"fragments",
"as",
"it",
"is",
"read",
"in",
"from",
"the",
"socket",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/lib/extensions/net-http/net/http.rb#L2395-L2411 |
17,322 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/rest-client-1.7.2/lib/restclient/abstract_response.rb | RestClient.AbstractResponse.follow_redirection | def follow_redirection request = nil, result = nil, & block
url = headers[:location]
if url !~ /^http/
url = URI.parse(args[:url]).merge(url).to_s
end
args[:url] = url
if request
if request.max_redirects == 0
raise MaxRedirectsReached
end
args[:pas... | ruby | def follow_redirection request = nil, result = nil, & block
url = headers[:location]
if url !~ /^http/
url = URI.parse(args[:url]).merge(url).to_s
end
args[:url] = url
if request
if request.max_redirects == 0
raise MaxRedirectsReached
end
args[:pas... | [
"def",
"follow_redirection",
"request",
"=",
"nil",
",",
"result",
"=",
"nil",
",",
"&",
"block",
"url",
"=",
"headers",
"[",
":location",
"]",
"if",
"url",
"!~",
"/",
"/",
"url",
"=",
"URI",
".",
"parse",
"(",
"args",
"[",
":url",
"]",
")",
".",
... | Follow a redirection | [
"Follow",
"a",
"redirection"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/rest-client-1.7.2/lib/restclient/abstract_response.rb#L63-L83 |
17,323 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/rest-client-1.7.2/lib/restclient/abstract_response.rb | RestClient.AbstractResponse.parse_cookie | def parse_cookie cookie_content
out = {}
CGI::Cookie::parse(cookie_content).each do |key, cookie|
unless ['expires', 'path'].include? key
out[CGI::escape(key)] = cookie.value[0] ? (CGI::escape(cookie.value[0]) || '') : ''
end
end
out
end | ruby | def parse_cookie cookie_content
out = {}
CGI::Cookie::parse(cookie_content).each do |key, cookie|
unless ['expires', 'path'].include? key
out[CGI::escape(key)] = cookie.value[0] ? (CGI::escape(cookie.value[0]) || '') : ''
end
end
out
end | [
"def",
"parse_cookie",
"cookie_content",
"out",
"=",
"{",
"}",
"CGI",
"::",
"Cookie",
"::",
"parse",
"(",
"cookie_content",
")",
".",
"each",
"do",
"|",
"key",
",",
"cookie",
"|",
"unless",
"[",
"'expires'",
",",
"'path'",
"]",
".",
"include?",
"key",
... | Parse a cookie value and return its content in an Hash | [
"Parse",
"a",
"cookie",
"value",
"and",
"return",
"its",
"content",
"in",
"an",
"Hash"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/gems/2.1.0/gems/rest-client-1.7.2/lib/restclient/abstract_response.rb#L95-L103 |
17,324 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/task_manager.rb | Rake.TaskManager.[] | def [](task_name, scopes=nil)
task_name = task_name.to_s
self.lookup(task_name, scopes) or
enhance_with_matching_rule(task_name) or
synthesize_file_task(task_name) or
fail "Don't know how to build task '#{task_name}'"
end | ruby | def [](task_name, scopes=nil)
task_name = task_name.to_s
self.lookup(task_name, scopes) or
enhance_with_matching_rule(task_name) or
synthesize_file_task(task_name) or
fail "Don't know how to build task '#{task_name}'"
end | [
"def",
"[]",
"(",
"task_name",
",",
"scopes",
"=",
"nil",
")",
"task_name",
"=",
"task_name",
".",
"to_s",
"self",
".",
"lookup",
"(",
"task_name",
",",
"scopes",
")",
"or",
"enhance_with_matching_rule",
"(",
"task_name",
")",
"or",
"synthesize_file_task",
"... | Find a matching task for +task_name+. | [
"Find",
"a",
"matching",
"task",
"for",
"+",
"task_name",
"+",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/task_manager.rb#L44-L50 |
17,325 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.run | def run(sock)
while true
res = HTTPResponse.new(@config)
req = HTTPRequest.new(@config)
server = self
begin
timeout = @config[:RequestTimeout]
while timeout > 0
break if IO.select([sock], nil, nil, 0.5)
timeout = 0 if @status != :Running
... | ruby | def run(sock)
while true
res = HTTPResponse.new(@config)
req = HTTPRequest.new(@config)
server = self
begin
timeout = @config[:RequestTimeout]
while timeout > 0
break if IO.select([sock], nil, nil, 0.5)
timeout = 0 if @status != :Running
... | [
"def",
"run",
"(",
"sock",
")",
"while",
"true",
"res",
"=",
"HTTPResponse",
".",
"new",
"(",
"@config",
")",
"req",
"=",
"HTTPRequest",
".",
"new",
"(",
"@config",
")",
"server",
"=",
"self",
"begin",
"timeout",
"=",
"@config",
"[",
":RequestTimeout",
... | Creates a new HTTP server according to +config+
An HTTP server uses the following attributes:
:AccessLog:: An array of access logs. See WEBrick::AccessLog
:BindAddress:: Local address for the server to bind to
:DocumentRoot:: Root path to serve files from
:DocumentRootOptions:: Options for the default HTTPServl... | [
"Creates",
"a",
"new",
"HTTP",
"server",
"according",
"to",
"+",
"config",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L67-L118 |
17,326 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.service | def service(req, res)
if req.unparsed_uri == "*"
if req.request_method == "OPTIONS"
do_OPTIONS(req, res)
raise HTTPStatus::OK
end
raise HTTPStatus::NotFound, "`#{req.unparsed_uri}' not found."
end
servlet, options, script_name, path_info = search_servlet(re... | ruby | def service(req, res)
if req.unparsed_uri == "*"
if req.request_method == "OPTIONS"
do_OPTIONS(req, res)
raise HTTPStatus::OK
end
raise HTTPStatus::NotFound, "`#{req.unparsed_uri}' not found."
end
servlet, options, script_name, path_info = search_servlet(re... | [
"def",
"service",
"(",
"req",
",",
"res",
")",
"if",
"req",
".",
"unparsed_uri",
"==",
"\"*\"",
"if",
"req",
".",
"request_method",
"==",
"\"OPTIONS\"",
"do_OPTIONS",
"(",
"req",
",",
"res",
")",
"raise",
"HTTPStatus",
"::",
"OK",
"end",
"raise",
"HTTPSt... | Services +req+ and fills in +res+ | [
"Services",
"+",
"req",
"+",
"and",
"fills",
"in",
"+",
"res",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L123-L139 |
17,327 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.mount | def mount(dir, servlet, *options)
@logger.debug(sprintf("%s is mounted on %s.", servlet.inspect, dir))
@mount_tab[dir] = [ servlet, options ]
end | ruby | def mount(dir, servlet, *options)
@logger.debug(sprintf("%s is mounted on %s.", servlet.inspect, dir))
@mount_tab[dir] = [ servlet, options ]
end | [
"def",
"mount",
"(",
"dir",
",",
"servlet",
",",
"*",
"options",
")",
"@logger",
".",
"debug",
"(",
"sprintf",
"(",
"\"%s is mounted on %s.\"",
",",
"servlet",
".",
"inspect",
",",
"dir",
")",
")",
"@mount_tab",
"[",
"dir",
"]",
"=",
"[",
"servlet",
",... | Mounts +servlet+ on +dir+ passing +options+ to the servlet at creation
time | [
"Mounts",
"+",
"servlet",
"+",
"on",
"+",
"dir",
"+",
"passing",
"+",
"options",
"+",
"to",
"the",
"servlet",
"at",
"creation",
"time"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L153-L156 |
17,328 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.search_servlet | def search_servlet(path)
script_name, path_info = @mount_tab.scan(path)
servlet, options = @mount_tab[script_name]
if servlet
[ servlet, options, script_name, path_info ]
end
end | ruby | def search_servlet(path)
script_name, path_info = @mount_tab.scan(path)
servlet, options = @mount_tab[script_name]
if servlet
[ servlet, options, script_name, path_info ]
end
end | [
"def",
"search_servlet",
"(",
"path",
")",
"script_name",
",",
"path_info",
"=",
"@mount_tab",
".",
"scan",
"(",
"path",
")",
"servlet",
",",
"options",
"=",
"@mount_tab",
"[",
"script_name",
"]",
"if",
"servlet",
"[",
"servlet",
",",
"options",
",",
"scri... | Finds a servlet for +path+ | [
"Finds",
"a",
"servlet",
"for",
"+",
"path",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L180-L186 |
17,329 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.virtual_host | def virtual_host(server)
@virtual_hosts << server
@virtual_hosts = @virtual_hosts.sort_by{|s|
num = 0
num -= 4 if s[:BindAddress]
num -= 2 if s[:Port]
num -= 1 if s[:ServerName]
num
}
end | ruby | def virtual_host(server)
@virtual_hosts << server
@virtual_hosts = @virtual_hosts.sort_by{|s|
num = 0
num -= 4 if s[:BindAddress]
num -= 2 if s[:Port]
num -= 1 if s[:ServerName]
num
}
end | [
"def",
"virtual_host",
"(",
"server",
")",
"@virtual_hosts",
"<<",
"server",
"@virtual_hosts",
"=",
"@virtual_hosts",
".",
"sort_by",
"{",
"|",
"s",
"|",
"num",
"=",
"0",
"num",
"-=",
"4",
"if",
"s",
"[",
":BindAddress",
"]",
"num",
"-=",
"2",
"if",
"s... | Adds +server+ as a virtual host. | [
"Adds",
"+",
"server",
"+",
"as",
"a",
"virtual",
"host",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L191-L200 |
17,330 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.lookup_server | def lookup_server(req)
@virtual_hosts.find{|s|
(s[:BindAddress].nil? || req.addr[3] == s[:BindAddress]) &&
(s[:Port].nil? || req.port == s[:Port]) &&
((s[:ServerName].nil? || req.host == s[:ServerName]) ||
(!s[:ServerAlias].nil? && s[:ServerAlias].find{|h| h === ... | ruby | def lookup_server(req)
@virtual_hosts.find{|s|
(s[:BindAddress].nil? || req.addr[3] == s[:BindAddress]) &&
(s[:Port].nil? || req.port == s[:Port]) &&
((s[:ServerName].nil? || req.host == s[:ServerName]) ||
(!s[:ServerAlias].nil? && s[:ServerAlias].find{|h| h === ... | [
"def",
"lookup_server",
"(",
"req",
")",
"@virtual_hosts",
".",
"find",
"{",
"|",
"s",
"|",
"(",
"s",
"[",
":BindAddress",
"]",
".",
"nil?",
"||",
"req",
".",
"addr",
"[",
"3",
"]",
"==",
"s",
"[",
":BindAddress",
"]",
")",
"&&",
"(",
"s",
"[",
... | Finds the appropriate virtual host to handle +req+ | [
"Finds",
"the",
"appropriate",
"virtual",
"host",
"to",
"handle",
"+",
"req",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L205-L212 |
17,331 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb | WEBrick.HTTPServer.access_log | def access_log(config, req, res)
param = AccessLog::setup_params(config, req, res)
@config[:AccessLog].each{|logger, fmt|
logger << AccessLog::format(fmt+"\n", param)
}
end | ruby | def access_log(config, req, res)
param = AccessLog::setup_params(config, req, res)
@config[:AccessLog].each{|logger, fmt|
logger << AccessLog::format(fmt+"\n", param)
}
end | [
"def",
"access_log",
"(",
"config",
",",
"req",
",",
"res",
")",
"param",
"=",
"AccessLog",
"::",
"setup_params",
"(",
"config",
",",
"req",
",",
"res",
")",
"@config",
"[",
":AccessLog",
"]",
".",
"each",
"{",
"|",
"logger",
",",
"fmt",
"|",
"logger... | Logs +req+ and +res+ in the access logs. +config+ is used for the
server name. | [
"Logs",
"+",
"req",
"+",
"and",
"+",
"res",
"+",
"in",
"the",
"access",
"logs",
".",
"+",
"config",
"+",
"is",
"used",
"for",
"the",
"server",
"name",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/httpserver.rb#L218-L223 |
17,332 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb | WEBrick.Utils.set_non_blocking | def set_non_blocking(io)
flag = File::NONBLOCK
if defined?(Fcntl::F_GETFL)
flag |= io.fcntl(Fcntl::F_GETFL)
end
io.fcntl(Fcntl::F_SETFL, flag)
end | ruby | def set_non_blocking(io)
flag = File::NONBLOCK
if defined?(Fcntl::F_GETFL)
flag |= io.fcntl(Fcntl::F_GETFL)
end
io.fcntl(Fcntl::F_SETFL, flag)
end | [
"def",
"set_non_blocking",
"(",
"io",
")",
"flag",
"=",
"File",
"::",
"NONBLOCK",
"if",
"defined?",
"(",
"Fcntl",
"::",
"F_GETFL",
")",
"flag",
"|=",
"io",
".",
"fcntl",
"(",
"Fcntl",
"::",
"F_GETFL",
")",
"end",
"io",
".",
"fcntl",
"(",
"Fcntl",
"::... | Sets IO operations on +io+ to be non-blocking | [
"Sets",
"IO",
"operations",
"on",
"+",
"io",
"+",
"to",
"be",
"non",
"-",
"blocking"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb#L23-L29 |
17,333 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb | WEBrick.Utils.set_close_on_exec | def set_close_on_exec(io)
if defined?(Fcntl::FD_CLOEXEC)
io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
end
end | ruby | def set_close_on_exec(io)
if defined?(Fcntl::FD_CLOEXEC)
io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
end
end | [
"def",
"set_close_on_exec",
"(",
"io",
")",
"if",
"defined?",
"(",
"Fcntl",
"::",
"FD_CLOEXEC",
")",
"io",
".",
"fcntl",
"(",
"Fcntl",
"::",
"F_SETFD",
",",
"Fcntl",
"::",
"FD_CLOEXEC",
")",
"end",
"end"
] | Sets the close on exec flag for +io+ | [
"Sets",
"the",
"close",
"on",
"exec",
"flag",
"for",
"+",
"io",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb#L34-L38 |
17,334 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb | WEBrick.Utils.su | def su(user)
if defined?(Etc)
pw = Etc.getpwnam(user)
Process::initgroups(user, pw.gid)
Process::Sys::setgid(pw.gid)
Process::Sys::setuid(pw.uid)
else
warn("WEBrick::Utils::su doesn't work on this platform")
end
end | ruby | def su(user)
if defined?(Etc)
pw = Etc.getpwnam(user)
Process::initgroups(user, pw.gid)
Process::Sys::setgid(pw.gid)
Process::Sys::setuid(pw.uid)
else
warn("WEBrick::Utils::su doesn't work on this platform")
end
end | [
"def",
"su",
"(",
"user",
")",
"if",
"defined?",
"(",
"Etc",
")",
"pw",
"=",
"Etc",
".",
"getpwnam",
"(",
"user",
")",
"Process",
"::",
"initgroups",
"(",
"user",
",",
"pw",
".",
"gid",
")",
"Process",
"::",
"Sys",
"::",
"setgid",
"(",
"pw",
".",... | Changes the process's uid and gid to the ones of +user+ | [
"Changes",
"the",
"process",
"s",
"uid",
"and",
"gid",
"to",
"the",
"ones",
"of",
"+",
"user",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb#L43-L52 |
17,335 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb | WEBrick.Utils.random_string | def random_string(len)
rand_max = RAND_CHARS.bytesize
ret = ""
len.times{ ret << RAND_CHARS[rand(rand_max)] }
ret
end | ruby | def random_string(len)
rand_max = RAND_CHARS.bytesize
ret = ""
len.times{ ret << RAND_CHARS[rand(rand_max)] }
ret
end | [
"def",
"random_string",
"(",
"len",
")",
"rand_max",
"=",
"RAND_CHARS",
".",
"bytesize",
"ret",
"=",
"\"\"",
"len",
".",
"times",
"{",
"ret",
"<<",
"RAND_CHARS",
"[",
"rand",
"(",
"rand_max",
")",
"]",
"}",
"ret",
"end"
] | Generates a random string of length +len+ | [
"Generates",
"a",
"random",
"string",
"of",
"length",
"+",
"len",
"+"
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb#L92-L97 |
17,336 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb | WEBrick.Utils.timeout | def timeout(seconds, exception=Timeout::Error)
return yield if seconds.nil? or seconds.zero?
# raise ThreadError, "timeout within critical session" if Thread.critical
id = TimeoutHandler.register(seconds, exception)
begin
yield(seconds)
ensure
TimeoutHandler.cancel(id)
... | ruby | def timeout(seconds, exception=Timeout::Error)
return yield if seconds.nil? or seconds.zero?
# raise ThreadError, "timeout within critical session" if Thread.critical
id = TimeoutHandler.register(seconds, exception)
begin
yield(seconds)
ensure
TimeoutHandler.cancel(id)
... | [
"def",
"timeout",
"(",
"seconds",
",",
"exception",
"=",
"Timeout",
"::",
"Error",
")",
"return",
"yield",
"if",
"seconds",
".",
"nil?",
"or",
"seconds",
".",
"zero?",
"# raise ThreadError, \"timeout within critical session\" if Thread.critical",
"id",
"=",
"TimeoutHa... | Executes the passed block and raises +exception+ if execution takes more
than +seconds+.
If +seconds+ is zero or nil, simply executes the block | [
"Executes",
"the",
"passed",
"block",
"and",
"raises",
"+",
"exception",
"+",
"if",
"execution",
"takes",
"more",
"than",
"+",
"seconds",
"+",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/webrick/utils.rb#L219-L228 |
17,337 | rhomobile/rhodes | res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/contrib/ftptools.rb | Rake.FtpUploader.makedirs | def makedirs(path)
route = []
File.split(path).each do |dir|
route << dir
current_dir = File.join(route)
if @created[current_dir].nil?
@created[current_dir] = true
$stderr.puts "Creating Directory #{current_dir}" if @verbose
@ftp.mkdir(current_dir) resc... | ruby | def makedirs(path)
route = []
File.split(path).each do |dir|
route << dir
current_dir = File.join(route)
if @created[current_dir].nil?
@created[current_dir] = true
$stderr.puts "Creating Directory #{current_dir}" if @verbose
@ftp.mkdir(current_dir) resc... | [
"def",
"makedirs",
"(",
"path",
")",
"route",
"=",
"[",
"]",
"File",
".",
"split",
"(",
"path",
")",
".",
"each",
"do",
"|",
"dir",
"|",
"route",
"<<",
"dir",
"current_dir",
"=",
"File",
".",
"join",
"(",
"route",
")",
"if",
"@created",
"[",
"cur... | Create an FTP uploader targeting the directory +path+ on +host+
using the given account and password. +path+ will be the root
path of the uploader.
Create the directory +path+ in the uploader root path. | [
"Create",
"an",
"FTP",
"uploader",
"targeting",
"the",
"directory",
"+",
"path",
"+",
"on",
"+",
"host",
"+",
"using",
"the",
"given",
"account",
"and",
"password",
".",
"+",
"path",
"+",
"will",
"be",
"the",
"root",
"path",
"of",
"the",
"uploader",
".... | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/res/build-tools/ruby-standalone/212/usr/local/lib/ruby/2.1.0/rake/contrib/ftptools.rb#L103-L114 |
17,338 | rhomobile/rhodes | lib/extensions/digest/digest.rb | Digest.Instance.file | def file(name)
File.open(name, "rb") {|f|
buf = ""
while f.read(16384, buf)
update buf
end
}
self
end | ruby | def file(name)
File.open(name, "rb") {|f|
buf = ""
while f.read(16384, buf)
update buf
end
}
self
end | [
"def",
"file",
"(",
"name",
")",
"File",
".",
"open",
"(",
"name",
",",
"\"rb\"",
")",
"{",
"|",
"f",
"|",
"buf",
"=",
"\"\"",
"while",
"f",
".",
"read",
"(",
"16384",
",",
"buf",
")",
"update",
"buf",
"end",
"}",
"self",
"end"
] | updates the digest with the contents of a given file _name_ and
returns self. | [
"updates",
"the",
"digest",
"with",
"the",
"contents",
"of",
"a",
"given",
"file",
"_name_",
"and",
"returns",
"self",
"."
] | 3c5f87b1a44f0ba2865ca0e1dd780dd202f64872 | https://github.com/rhomobile/rhodes/blob/3c5f87b1a44f0ba2865ca0e1dd780dd202f64872/lib/extensions/digest/digest.rb#L36-L44 |
17,339 | oauth-xx/oauth-ruby | lib/oauth/tokens/request_token.rb | OAuth.RequestToken.authorize_url | def authorize_url(params = nil)
return nil if self.token.nil?
params = (params || {}).merge(:oauth_token => self.token)
build_authorize_url(consumer.authorize_url, params)
end | ruby | def authorize_url(params = nil)
return nil if self.token.nil?
params = (params || {}).merge(:oauth_token => self.token)
build_authorize_url(consumer.authorize_url, params)
end | [
"def",
"authorize_url",
"(",
"params",
"=",
"nil",
")",
"return",
"nil",
"if",
"self",
".",
"token",
".",
"nil?",
"params",
"=",
"(",
"params",
"||",
"{",
"}",
")",
".",
"merge",
"(",
":oauth_token",
"=>",
"self",
".",
"token",
")",
"build_authorize_ur... | Generate an authorization URL for user authorization | [
"Generate",
"an",
"authorization",
"URL",
"for",
"user",
"authorization"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/tokens/request_token.rb#L7-L12 |
17,340 | oauth-xx/oauth-ruby | lib/oauth/tokens/request_token.rb | OAuth.RequestToken.get_access_token | def get_access_token(options = {}, *arguments)
response = consumer.token_request(consumer.http_method, (consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path), self, options, *arguments)
OAuth::AccessToken.from_hash(consumer, response)
end | ruby | def get_access_token(options = {}, *arguments)
response = consumer.token_request(consumer.http_method, (consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path), self, options, *arguments)
OAuth::AccessToken.from_hash(consumer, response)
end | [
"def",
"get_access_token",
"(",
"options",
"=",
"{",
"}",
",",
"*",
"arguments",
")",
"response",
"=",
"consumer",
".",
"token_request",
"(",
"consumer",
".",
"http_method",
",",
"(",
"consumer",
".",
"access_token_url?",
"?",
"consumer",
".",
"access_token_ur... | exchange for AccessToken on server | [
"exchange",
"for",
"AccessToken",
"on",
"server"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/tokens/request_token.rb#L19-L22 |
17,341 | oauth-xx/oauth-ruby | lib/oauth/tokens/request_token.rb | OAuth.RequestToken.build_authorize_url | def build_authorize_url(base_url, params)
uri = URI.parse(base_url.to_s)
queries = {}
queries = Hash[URI.decode_www_form(uri.query)] if uri.query
# TODO doesn't handle array values correctly
queries.merge!(params) if params
uri.query = URI.encode_www_form(queries) if !queries.empty?
... | ruby | def build_authorize_url(base_url, params)
uri = URI.parse(base_url.to_s)
queries = {}
queries = Hash[URI.decode_www_form(uri.query)] if uri.query
# TODO doesn't handle array values correctly
queries.merge!(params) if params
uri.query = URI.encode_www_form(queries) if !queries.empty?
... | [
"def",
"build_authorize_url",
"(",
"base_url",
",",
"params",
")",
"uri",
"=",
"URI",
".",
"parse",
"(",
"base_url",
".",
"to_s",
")",
"queries",
"=",
"{",
"}",
"queries",
"=",
"Hash",
"[",
"URI",
".",
"decode_www_form",
"(",
"uri",
".",
"query",
")",
... | construct an authorization url | [
"construct",
"an",
"authorization",
"url"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/tokens/request_token.rb#L27-L35 |
17,342 | oauth-xx/oauth-ruby | lib/oauth/request_proxy/base.rb | OAuth::RequestProxy.Base.signature_base_string | def signature_base_string
base = [method, normalized_uri, normalized_parameters]
base.map { |v| escape(v) }.join("&")
end | ruby | def signature_base_string
base = [method, normalized_uri, normalized_parameters]
base.map { |v| escape(v) }.join("&")
end | [
"def",
"signature_base_string",
"base",
"=",
"[",
"method",
",",
"normalized_uri",
",",
"normalized_parameters",
"]",
"base",
".",
"map",
"{",
"|",
"v",
"|",
"escape",
"(",
"v",
")",
"}",
".",
"join",
"(",
"\"&\"",
")",
"end"
] | See 9.1 in specs | [
"See",
"9",
".",
"1",
"in",
"specs"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/request_proxy/base.rb#L116-L119 |
17,343 | oauth-xx/oauth-ruby | lib/oauth/request_proxy/base.rb | OAuth::RequestProxy.Base.signed_uri | def signed_uri(with_oauth = true)
if signed?
if with_oauth
params = parameters
else
params = non_oauth_parameters
end
[uri, normalize(params)] * "?"
else
STDERR.puts "This request has not yet been signed!"
end
end | ruby | def signed_uri(with_oauth = true)
if signed?
if with_oauth
params = parameters
else
params = non_oauth_parameters
end
[uri, normalize(params)] * "?"
else
STDERR.puts "This request has not yet been signed!"
end
end | [
"def",
"signed_uri",
"(",
"with_oauth",
"=",
"true",
")",
"if",
"signed?",
"if",
"with_oauth",
"params",
"=",
"parameters",
"else",
"params",
"=",
"non_oauth_parameters",
"end",
"[",
"uri",
",",
"normalize",
"(",
"params",
")",
"]",
"*",
"\"?\"",
"else",
"... | URI, including OAuth parameters | [
"URI",
"including",
"OAuth",
"parameters"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/request_proxy/base.rb#L127-L139 |
17,344 | oauth-xx/oauth-ruby | lib/oauth/request_proxy/base.rb | OAuth::RequestProxy.Base.oauth_header | def oauth_header(options = {})
header_params_str = oauth_parameters.map { |k,v| "#{k}=\"#{escape(v)}\"" }.join(', ')
realm = "realm=\"#{options[:realm]}\", " if options[:realm]
"OAuth #{realm}#{header_params_str}"
end | ruby | def oauth_header(options = {})
header_params_str = oauth_parameters.map { |k,v| "#{k}=\"#{escape(v)}\"" }.join(', ')
realm = "realm=\"#{options[:realm]}\", " if options[:realm]
"OAuth #{realm}#{header_params_str}"
end | [
"def",
"oauth_header",
"(",
"options",
"=",
"{",
"}",
")",
"header_params_str",
"=",
"oauth_parameters",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"\"#{k}=\\\"#{escape(v)}\\\"\"",
"}",
".",
"join",
"(",
"', '",
")",
"realm",
"=",
"\"realm=\\\"#{options[:realm]... | Authorization header for OAuth | [
"Authorization",
"header",
"for",
"OAuth"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/request_proxy/base.rb#L142-L147 |
17,345 | oauth-xx/oauth-ruby | lib/oauth/consumer.rb | OAuth.Consumer.create_signed_request | def create_signed_request(http_method, path, token = nil, request_options = {}, *arguments)
request = create_http_request(http_method, path, *arguments)
sign!(request, token, request_options)
request
end | ruby | def create_signed_request(http_method, path, token = nil, request_options = {}, *arguments)
request = create_http_request(http_method, path, *arguments)
sign!(request, token, request_options)
request
end | [
"def",
"create_signed_request",
"(",
"http_method",
",",
"path",
",",
"token",
"=",
"nil",
",",
"request_options",
"=",
"{",
"}",
",",
"*",
"arguments",
")",
"request",
"=",
"create_http_request",
"(",
"http_method",
",",
"path",
",",
"arguments",
")",
"sign... | Creates and signs an http request.
It's recommended to use the Token classes to set this up correctly | [
"Creates",
"and",
"signs",
"an",
"http",
"request",
".",
"It",
"s",
"recommended",
"to",
"use",
"the",
"Token",
"classes",
"to",
"set",
"this",
"up",
"correctly"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/consumer.rb#L205-L209 |
17,346 | oauth-xx/oauth-ruby | lib/oauth/consumer.rb | OAuth.Consumer.token_request | def token_request(http_method, path, token = nil, request_options = {}, *arguments)
request_options[:token_request] ||= true
response = request(http_method, path, token, request_options, *arguments)
case response.code.to_i
when (200..299)
if block_given?
yield response.body
... | ruby | def token_request(http_method, path, token = nil, request_options = {}, *arguments)
request_options[:token_request] ||= true
response = request(http_method, path, token, request_options, *arguments)
case response.code.to_i
when (200..299)
if block_given?
yield response.body
... | [
"def",
"token_request",
"(",
"http_method",
",",
"path",
",",
"token",
"=",
"nil",
",",
"request_options",
"=",
"{",
"}",
",",
"*",
"arguments",
")",
"request_options",
"[",
":token_request",
"]",
"||=",
"true",
"response",
"=",
"request",
"(",
"http_method"... | Creates a request and parses the result as url_encoded. This is used internally for the RequestToken and AccessToken requests. | [
"Creates",
"a",
"request",
"and",
"parses",
"the",
"result",
"as",
"url_encoded",
".",
"This",
"is",
"used",
"internally",
"for",
"the",
"RequestToken",
"and",
"AccessToken",
"requests",
"."
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/consumer.rb#L212-L240 |
17,347 | oauth-xx/oauth-ruby | lib/oauth/consumer.rb | OAuth.Consumer.sign! | def sign!(request, token = nil, request_options = {})
request.oauth!(http, self, token, options.merge(request_options))
end | ruby | def sign!(request, token = nil, request_options = {})
request.oauth!(http, self, token, options.merge(request_options))
end | [
"def",
"sign!",
"(",
"request",
",",
"token",
"=",
"nil",
",",
"request_options",
"=",
"{",
"}",
")",
"request",
".",
"oauth!",
"(",
"http",
",",
"self",
",",
"token",
",",
"options",
".",
"merge",
"(",
"request_options",
")",
")",
"end"
] | Sign the Request object. Use this if you have an externally generated http request object you want to sign. | [
"Sign",
"the",
"Request",
"object",
".",
"Use",
"this",
"if",
"you",
"have",
"an",
"externally",
"generated",
"http",
"request",
"object",
"you",
"want",
"to",
"sign",
"."
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/consumer.rb#L243-L245 |
17,348 | oauth-xx/oauth-ruby | lib/oauth/consumer.rb | OAuth.Consumer.signature_base_string | def signature_base_string(request, token = nil, request_options = {})
request.signature_base_string(http, self, token, options.merge(request_options))
end | ruby | def signature_base_string(request, token = nil, request_options = {})
request.signature_base_string(http, self, token, options.merge(request_options))
end | [
"def",
"signature_base_string",
"(",
"request",
",",
"token",
"=",
"nil",
",",
"request_options",
"=",
"{",
"}",
")",
"request",
".",
"signature_base_string",
"(",
"http",
",",
"self",
",",
"token",
",",
"options",
".",
"merge",
"(",
"request_options",
")",
... | Return the signature_base_string | [
"Return",
"the",
"signature_base_string"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/consumer.rb#L248-L250 |
17,349 | oauth-xx/oauth-ruby | lib/oauth/consumer.rb | OAuth.Consumer.create_http_request | def create_http_request(http_method, path, *arguments)
http_method = http_method.to_sym
if [:post, :put, :patch].include?(http_method)
data = arguments.shift
end
# if the base site contains a path, add it now
# only add if the site host matches the current http object's host
... | ruby | def create_http_request(http_method, path, *arguments)
http_method = http_method.to_sym
if [:post, :put, :patch].include?(http_method)
data = arguments.shift
end
# if the base site contains a path, add it now
# only add if the site host matches the current http object's host
... | [
"def",
"create_http_request",
"(",
"http_method",
",",
"path",
",",
"*",
"arguments",
")",
"http_method",
"=",
"http_method",
".",
"to_sym",
"if",
"[",
":post",
",",
":put",
",",
":patch",
"]",
".",
"include?",
"(",
"http_method",
")",
"data",
"=",
"argume... | create the http request object for a given http_method and path | [
"create",
"the",
"http",
"request",
"object",
"for",
"a",
"given",
"http_method",
"and",
"path"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/consumer.rb#L350-L405 |
17,350 | oauth-xx/oauth-ruby | lib/oauth/helper.rb | OAuth.Helper.escape | def escape(value)
_escape(value.to_s.to_str)
rescue ArgumentError
_escape(value.to_s.to_str.force_encoding(Encoding::UTF_8))
end | ruby | def escape(value)
_escape(value.to_s.to_str)
rescue ArgumentError
_escape(value.to_s.to_str.force_encoding(Encoding::UTF_8))
end | [
"def",
"escape",
"(",
"value",
")",
"_escape",
"(",
"value",
".",
"to_s",
".",
"to_str",
")",
"rescue",
"ArgumentError",
"_escape",
"(",
"value",
".",
"to_s",
".",
"to_str",
".",
"force_encoding",
"(",
"Encoding",
"::",
"UTF_8",
")",
")",
"end"
] | Escape +value+ by URL encoding all non-reserved character.
See Also: {OAuth core spec version 1.0, section 5.1}[http://oauth.net/core/1.0#rfc.section.5.1] | [
"Escape",
"+",
"value",
"+",
"by",
"URL",
"encoding",
"all",
"non",
"-",
"reserved",
"character",
"."
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/helper.rb#L11-L15 |
17,351 | oauth-xx/oauth-ruby | lib/oauth/helper.rb | OAuth.Helper.normalize | def normalize(params)
params.sort.map do |k, values|
if values.is_a?(Array)
# make sure the array has an element so we don't lose the key
values << nil if values.empty?
# multiple values were provided for a single key
values.sort.collect do |v|
[escape(k... | ruby | def normalize(params)
params.sort.map do |k, values|
if values.is_a?(Array)
# make sure the array has an element so we don't lose the key
values << nil if values.empty?
# multiple values were provided for a single key
values.sort.collect do |v|
[escape(k... | [
"def",
"normalize",
"(",
"params",
")",
"params",
".",
"sort",
".",
"map",
"do",
"|",
"k",
",",
"values",
"|",
"if",
"values",
".",
"is_a?",
"(",
"Array",
")",
"# make sure the array has an element so we don't lose the key",
"values",
"<<",
"nil",
"if",
"value... | Normalize a +Hash+ of parameter values. Parameters are sorted by name, using lexicographical
byte value ordering. If two or more parameters share the same name, they are sorted by their value.
Parameters are concatenated in their sorted order into a single string. For each parameter, the name
is separated from the c... | [
"Normalize",
"a",
"+",
"Hash",
"+",
"of",
"parameter",
"values",
".",
"Parameters",
"are",
"sorted",
"by",
"name",
"using",
"lexicographical",
"byte",
"value",
"ordering",
".",
"If",
"two",
"or",
"more",
"parameters",
"share",
"the",
"same",
"name",
"they",
... | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/helper.rb#L44-L59 |
17,352 | oauth-xx/oauth-ruby | lib/oauth/server.rb | OAuth.Server.create_consumer | def create_consumer
creds = generate_credentials
Consumer.new(creds[0], creds[1],
{
:site => base_url,
:request_token_path => request_token_path,
:authorize_path => authorize_path,
:access_token_path => access_token_path
})
end | ruby | def create_consumer
creds = generate_credentials
Consumer.new(creds[0], creds[1],
{
:site => base_url,
:request_token_path => request_token_path,
:authorize_path => authorize_path,
:access_token_path => access_token_path
})
end | [
"def",
"create_consumer",
"creds",
"=",
"generate_credentials",
"Consumer",
".",
"new",
"(",
"creds",
"[",
"0",
"]",
",",
"creds",
"[",
"1",
"]",
",",
"{",
":site",
"=>",
"base_url",
",",
":request_token_path",
"=>",
"request_token_path",
",",
":authorize_path... | mainly for testing purposes | [
"mainly",
"for",
"testing",
"purposes"
] | cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14 | https://github.com/oauth-xx/oauth-ruby/blob/cb9b9db64f520dc0ee87fe6e4fe82a7601cffb14/lib/oauth/server.rb#L31-L40 |
17,353 | graylog-labs/gelf-rb | lib/gelf/notifier.rb | GELF.Notifier.convert_hoptoad_keys_to_graylog2 | def convert_hoptoad_keys_to_graylog2(hash)
if hash['short_message'].to_s.empty?
if hash.has_key?('error_class') && hash.has_key?('error_message')
hash['short_message'] = hash.delete('error_class') + ': ' + hash.delete('error_message')
end
end
end | ruby | def convert_hoptoad_keys_to_graylog2(hash)
if hash['short_message'].to_s.empty?
if hash.has_key?('error_class') && hash.has_key?('error_message')
hash['short_message'] = hash.delete('error_class') + ': ' + hash.delete('error_message')
end
end
end | [
"def",
"convert_hoptoad_keys_to_graylog2",
"(",
"hash",
")",
"if",
"hash",
"[",
"'short_message'",
"]",
".",
"to_s",
".",
"empty?",
"if",
"hash",
".",
"has_key?",
"(",
"'error_class'",
")",
"&&",
"hash",
".",
"has_key?",
"(",
"'error_message'",
")",
"hash",
... | Converts Hoptoad-specific keys in +@hash+ to Graylog2-specific. | [
"Converts",
"Hoptoad",
"-",
"specific",
"keys",
"in",
"+"
] | eb2d31cdc4b37c316de880122279bcac52a08ba2 | https://github.com/graylog-labs/gelf-rb/blob/eb2d31cdc4b37c316de880122279bcac52a08ba2/lib/gelf/notifier.rb#L201-L207 |
17,354 | lassebunk/gretel | lib/gretel/crumb.rb | Gretel.Crumb.parent | def parent(*args)
return @parent if args.empty?
key = args.shift
@parent = Gretel::Crumb.new(context, key, *args)
end | ruby | def parent(*args)
return @parent if args.empty?
key = args.shift
@parent = Gretel::Crumb.new(context, key, *args)
end | [
"def",
"parent",
"(",
"*",
"args",
")",
"return",
"@parent",
"if",
"args",
".",
"empty?",
"key",
"=",
"args",
".",
"shift",
"@parent",
"=",
"Gretel",
"::",
"Crumb",
".",
"new",
"(",
"context",
",",
"key",
",",
"args",
")",
"end"
] | Sets or gets the parent breadcrumb.
If you supply a parent key and optional arguments, it will set the parent.
If nothing is supplied, it will return the parent, if this has been set.
Example:
parent :category, category
Or short, which will infer the key from the model's `model_name`:
parent category | [
"Sets",
"or",
"gets",
"the",
"parent",
"breadcrumb",
".",
"If",
"you",
"supply",
"a",
"parent",
"key",
"and",
"optional",
"arguments",
"it",
"will",
"set",
"the",
"parent",
".",
"If",
"nothing",
"is",
"supplied",
"it",
"will",
"return",
"the",
"parent",
... | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/crumb.rb#L50-L55 |
17,355 | lassebunk/gretel | lib/gretel/link.rb | Gretel.Link.method_missing | def method_missing(method, *args, &block)
if method =~ /(.+)\?$/
options[$1.to_sym].present?
else
options[method]
end
end | ruby | def method_missing(method, *args, &block)
if method =~ /(.+)\?$/
options[$1.to_sym].present?
else
options[method]
end
end | [
"def",
"method_missing",
"(",
"method",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"method",
"=~",
"/",
"\\?",
"/",
"options",
"[",
"$1",
".",
"to_sym",
"]",
".",
"present?",
"else",
"options",
"[",
"method",
"]",
"end",
"end"
] | Enables accessors and predicate methods for values in the +options+ hash.
This can be used to pass information to links when rendering breadcrumbs
manually.
link = Link.new(:my_crumb, "My Crumb", my_path, title: "Test Title", other_value: "Other")
link.title? # => true
link.title # => "Test Tit... | [
"Enables",
"accessors",
"and",
"predicate",
"methods",
"for",
"values",
"in",
"the",
"+",
"options",
"+",
"hash",
".",
"This",
"can",
"be",
"used",
"to",
"pass",
"information",
"to",
"links",
"when",
"rendering",
"breadcrumbs",
"manually",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/link.rb#L31-L37 |
17,356 | lassebunk/gretel | lib/gretel/view_helpers.rb | Gretel.ViewHelpers.with_breadcrumb | def with_breadcrumb(key, *args, &block)
original_renderer = @_gretel_renderer
@_gretel_renderer = Gretel::Renderer.new(self, key, *args)
yield
@_gretel_renderer = original_renderer
end | ruby | def with_breadcrumb(key, *args, &block)
original_renderer = @_gretel_renderer
@_gretel_renderer = Gretel::Renderer.new(self, key, *args)
yield
@_gretel_renderer = original_renderer
end | [
"def",
"with_breadcrumb",
"(",
"key",
",",
"*",
"args",
",",
"&",
"block",
")",
"original_renderer",
"=",
"@_gretel_renderer",
"@_gretel_renderer",
"=",
"Gretel",
"::",
"Renderer",
".",
"new",
"(",
"self",
",",
"key",
",",
"args",
")",
"yield",
"@_gretel_ren... | Yields a block where inside the block you have a different breadcrumb than outside.
<% breadcrumb :about %>
<%= breadcrumbs # shows the :about breadcrumb %>
<% with_breadcrumb :product, Product.first do %>
<%= breadcrumbs # shows the :product breadcrumb %>
<% end %>
<%= breadcrumbs # shows the :... | [
"Yields",
"a",
"block",
"where",
"inside",
"the",
"block",
"you",
"have",
"a",
"different",
"breadcrumb",
"than",
"outside",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/view_helpers.rb#L28-L33 |
17,357 | lassebunk/gretel | lib/gretel/renderer.rb | Gretel.Renderer.render | def render(options)
options = options_for_render(options)
links = links_for_render(options)
LinkCollection.new(context, links, options)
end | ruby | def render(options)
options = options_for_render(options)
links = links_for_render(options)
LinkCollection.new(context, links, options)
end | [
"def",
"render",
"(",
"options",
")",
"options",
"=",
"options_for_render",
"(",
"options",
")",
"links",
"=",
"links_for_render",
"(",
"options",
")",
"LinkCollection",
".",
"new",
"(",
"context",
",",
"links",
",",
"options",
")",
"end"
] | Renders the breadcrumbs HTML. | [
"Renders",
"the",
"breadcrumbs",
"HTML",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/renderer.rb#L35-L40 |
17,358 | lassebunk/gretel | lib/gretel/renderer.rb | Gretel.Renderer.options_for_render | def options_for_render(options = {})
style = options_for_style(options[:style] || DEFAULT_OPTIONS[:style])
DEFAULT_OPTIONS.merge(style).merge(options)
end | ruby | def options_for_render(options = {})
style = options_for_style(options[:style] || DEFAULT_OPTIONS[:style])
DEFAULT_OPTIONS.merge(style).merge(options)
end | [
"def",
"options_for_render",
"(",
"options",
"=",
"{",
"}",
")",
"style",
"=",
"options_for_style",
"(",
"options",
"[",
":style",
"]",
"||",
"DEFAULT_OPTIONS",
"[",
":style",
"]",
")",
"DEFAULT_OPTIONS",
".",
"merge",
"(",
"style",
")",
".",
"merge",
"(",... | Returns merged options for rendering breadcrumbs. | [
"Returns",
"merged",
"options",
"for",
"rendering",
"breadcrumbs",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/renderer.rb#L64-L67 |
17,359 | lassebunk/gretel | lib/gretel/renderer.rb | Gretel.Renderer.links_for_render | def links_for_render(options = {})
out = links.dup
# Handle autoroot
if options[:autoroot] && out.map(&:key).exclude?(:root) && Gretel::Crumbs.crumb_defined?(:root)
out.unshift *Gretel::Crumb.new(context, :root).links
end
# Set current link to actual path
if options[:link_c... | ruby | def links_for_render(options = {})
out = links.dup
# Handle autoroot
if options[:autoroot] && out.map(&:key).exclude?(:root) && Gretel::Crumbs.crumb_defined?(:root)
out.unshift *Gretel::Crumb.new(context, :root).links
end
# Set current link to actual path
if options[:link_c... | [
"def",
"links_for_render",
"(",
"options",
"=",
"{",
"}",
")",
"out",
"=",
"links",
".",
"dup",
"# Handle autoroot",
"if",
"options",
"[",
":autoroot",
"]",
"&&",
"out",
".",
"map",
"(",
":key",
")",
".",
"exclude?",
"(",
":root",
")",
"&&",
"Gretel",
... | Array of links with applied options. | [
"Array",
"of",
"links",
"with",
"applied",
"options",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/renderer.rb#L79-L101 |
17,360 | lassebunk/gretel | lib/gretel/renderer.rb | Gretel.Renderer.links | def links
@links ||= if @breadcrumb_key.present?
# Reload breadcrumbs configuration if needed
Gretel::Crumbs.reload_if_needed
# Get breadcrumb set by the `breadcrumb` method
crumb = Gretel::Crumb.new(context, breadcrumb_key, *breadcrumb_args)
# Links of first crumb
... | ruby | def links
@links ||= if @breadcrumb_key.present?
# Reload breadcrumbs configuration if needed
Gretel::Crumbs.reload_if_needed
# Get breadcrumb set by the `breadcrumb` method
crumb = Gretel::Crumb.new(context, breadcrumb_key, *breadcrumb_args)
# Links of first crumb
... | [
"def",
"links",
"@links",
"||=",
"if",
"@breadcrumb_key",
".",
"present?",
"# Reload breadcrumbs configuration if needed",
"Gretel",
"::",
"Crumbs",
".",
"reload_if_needed",
"# Get breadcrumb set by the `breadcrumb` method",
"crumb",
"=",
"Gretel",
"::",
"Crumb",
".",
"new"... | Array of links for the path of the breadcrumb.
Also reloads the breadcrumb configuration if needed. | [
"Array",
"of",
"links",
"for",
"the",
"path",
"of",
"the",
"breadcrumb",
".",
"Also",
"reloads",
"the",
"breadcrumb",
"configuration",
"if",
"needed",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/renderer.rb#L105-L123 |
17,361 | lassebunk/gretel | lib/gretel/renderer.rb | Gretel.Renderer.parent_links_for | def parent_links_for(crumb)
links = []
while crumb = crumb.parent
links.unshift *crumb.links
end
links
end | ruby | def parent_links_for(crumb)
links = []
while crumb = crumb.parent
links.unshift *crumb.links
end
links
end | [
"def",
"parent_links_for",
"(",
"crumb",
")",
"links",
"=",
"[",
"]",
"while",
"crumb",
"=",
"crumb",
".",
"parent",
"links",
".",
"unshift",
"crumb",
".",
"links",
"end",
"links",
"end"
] | Returns parent links for the crumb. | [
"Returns",
"parent",
"links",
"for",
"the",
"crumb",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/renderer.rb#L126-L132 |
17,362 | lassebunk/gretel | lib/gretel/resettable.rb | Gretel.Resettable.reset! | def reset!
instance_variables.each { |var| remove_instance_variable var }
constants.each do |c|
c = const_get(c)
c.reset! if c.respond_to?(:reset!)
end
end | ruby | def reset!
instance_variables.each { |var| remove_instance_variable var }
constants.each do |c|
c = const_get(c)
c.reset! if c.respond_to?(:reset!)
end
end | [
"def",
"reset!",
"instance_variables",
".",
"each",
"{",
"|",
"var",
"|",
"remove_instance_variable",
"var",
"}",
"constants",
".",
"each",
"do",
"|",
"c",
"|",
"c",
"=",
"const_get",
"(",
"c",
")",
"c",
".",
"reset!",
"if",
"c",
".",
"respond_to?",
"(... | Resets all instance variables and calls +reset!+ on all child modules and
classes. Used for testing. | [
"Resets",
"all",
"instance",
"variables",
"and",
"calls",
"+",
"reset!",
"+",
"on",
"all",
"child",
"modules",
"and",
"classes",
".",
"Used",
"for",
"testing",
"."
] | a3b0c99c59571ca091dce15c61a80a71addc091a | https://github.com/lassebunk/gretel/blob/a3b0c99c59571ca091dce15c61a80a71addc091a/lib/gretel/resettable.rb#L5-L11 |
17,363 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.extract | def extract
FileUtils.mkdir_p source_dir
opts = {}
if tarball == "-"
# FIXME: not really happy with reading everything in memory
opts[:input] = $stdin.read
end
tarball_extract = Mixlib::ShellOut.new("tar xzf #{tarball} -C #{source_dir}", opts)
tarball_extract.logger... | ruby | def extract
FileUtils.mkdir_p source_dir
opts = {}
if tarball == "-"
# FIXME: not really happy with reading everything in memory
opts[:input] = $stdin.read
end
tarball_extract = Mixlib::ShellOut.new("tar xzf #{tarball} -C #{source_dir}", opts)
tarball_extract.logger... | [
"def",
"extract",
"FileUtils",
".",
"mkdir_p",
"source_dir",
"opts",
"=",
"{",
"}",
"if",
"tarball",
"==",
"\"-\"",
"# FIXME: not really happy with reading everything in memory",
"opts",
"[",
":input",
"]",
"=",
"$stdin",
".",
"read",
"end",
"tarball_extract",
"=",
... | Extract the given tarball to the target directory | [
"Extract",
"the",
"given",
"tarball",
"to",
"the",
"target",
"directory"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L39-L52 |
17,364 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.update_config | def update_config
if File.exist?(config_file)
Pkgr.debug "Loading #{distribution.slug} from #{config_file}."
@config = Config.load_file(config_file, distribution.slug).merge(config)
Pkgr.debug "Found .pkgr.yml file. Updated config is now: #{config.inspect}"
# update distribution c... | ruby | def update_config
if File.exist?(config_file)
Pkgr.debug "Loading #{distribution.slug} from #{config_file}."
@config = Config.load_file(config_file, distribution.slug).merge(config)
Pkgr.debug "Found .pkgr.yml file. Updated config is now: #{config.inspect}"
# update distribution c... | [
"def",
"update_config",
"if",
"File",
".",
"exist?",
"(",
"config_file",
")",
"Pkgr",
".",
"debug",
"\"Loading #{distribution.slug} from #{config_file}.\"",
"@config",
"=",
"Config",
".",
"load_file",
"(",
"config_file",
",",
"distribution",
".",
"slug",
")",
".",
... | Update existing config with the one from .pkgr.yml file, if any | [
"Update",
"existing",
"config",
"with",
"the",
"one",
"from",
".",
"pkgr",
".",
"yml",
"file",
"if",
"any"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L55-L75 |
17,365 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.check | def check
raise Errors::ConfigurationInvalid, config.errors.join("; ") unless config.valid?
distribution.check
end | ruby | def check
raise Errors::ConfigurationInvalid, config.errors.join("; ") unless config.valid?
distribution.check
end | [
"def",
"check",
"raise",
"Errors",
"::",
"ConfigurationInvalid",
",",
"config",
".",
"errors",
".",
"join",
"(",
"\"; \"",
")",
"unless",
"config",
".",
"valid?",
"distribution",
".",
"check",
"end"
] | Check configuration, and verifies that the current distribution's requirements are satisfied | [
"Check",
"configuration",
"and",
"verifies",
"that",
"the",
"current",
"distribution",
"s",
"requirements",
"are",
"satisfied"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L88-L91 |
17,366 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.setup | def setup
Dir.chdir(build_dir) do
distribution.templates.each do |template|
template.install(config.sesame)
end
end
end | ruby | def setup
Dir.chdir(build_dir) do
distribution.templates.each do |template|
template.install(config.sesame)
end
end
end | [
"def",
"setup",
"Dir",
".",
"chdir",
"(",
"build_dir",
")",
"do",
"distribution",
".",
"templates",
".",
"each",
"do",
"|",
"template",
"|",
"template",
".",
"install",
"(",
"config",
".",
"sesame",
")",
"end",
"end",
"end"
] | Setup the build directory structure | [
"Setup",
"the",
"build",
"directory",
"structure"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L94-L100 |
17,367 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.compile | def compile
begin
FileUtils.mkdir_p(app_home_dir)
rescue Errno::EACCES => e
Pkgr.logger.warn "Can't create #{app_home_dir.inspect}, which may be needed by some buildpacks."
end
FileUtils.mkdir_p(compile_cache_dir)
FileUtils.mkdir_p(compile_env_dir)
if buildpacks_for_... | ruby | def compile
begin
FileUtils.mkdir_p(app_home_dir)
rescue Errno::EACCES => e
Pkgr.logger.warn "Can't create #{app_home_dir.inspect}, which may be needed by some buildpacks."
end
FileUtils.mkdir_p(compile_cache_dir)
FileUtils.mkdir_p(compile_env_dir)
if buildpacks_for_... | [
"def",
"compile",
"begin",
"FileUtils",
".",
"mkdir_p",
"(",
"app_home_dir",
")",
"rescue",
"Errno",
"::",
"EACCES",
"=>",
"e",
"Pkgr",
".",
"logger",
".",
"warn",
"\"Can't create #{app_home_dir.inspect}, which may be needed by some buildpacks.\"",
"end",
"FileUtils",
"... | Pass the app through the buildpack | [
"Pass",
"the",
"app",
"through",
"the",
"buildpack"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L109-L131 |
17,368 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.write_init | def write_init
FileUtils.mkdir_p scaling_dir
Dir.chdir(scaling_dir) do
distribution.initializers_for(config.name, procfile_entries).each do |(process, file)|
process_config = config.dup
process_config.process_name = process.name
process_config.process_command = process.... | ruby | def write_init
FileUtils.mkdir_p scaling_dir
Dir.chdir(scaling_dir) do
distribution.initializers_for(config.name, procfile_entries).each do |(process, file)|
process_config = config.dup
process_config.process_name = process.name
process_config.process_command = process.... | [
"def",
"write_init",
"FileUtils",
".",
"mkdir_p",
"scaling_dir",
"Dir",
".",
"chdir",
"(",
"scaling_dir",
")",
"do",
"distribution",
".",
"initializers_for",
"(",
"config",
".",
"name",
",",
"procfile_entries",
")",
".",
"each",
"do",
"|",
"(",
"process",
",... | Write startup scripts. | [
"Write",
"startup",
"scripts",
"."
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L154-L164 |
17,369 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.setup_crons | def setup_crons
crons_dir = File.join("/", distribution.crons_dir)
config.crons.map! do |cron_path|
Cron.new(File.expand_path(cron_path, config.home), File.join(crons_dir, File.basename(cron_path)))
end
config.crons.each do |cron|
puts "-----> [cron] #{cron.source} => #{cron.de... | ruby | def setup_crons
crons_dir = File.join("/", distribution.crons_dir)
config.crons.map! do |cron_path|
Cron.new(File.expand_path(cron_path, config.home), File.join(crons_dir, File.basename(cron_path)))
end
config.crons.each do |cron|
puts "-----> [cron] #{cron.source} => #{cron.de... | [
"def",
"setup_crons",
"crons_dir",
"=",
"File",
".",
"join",
"(",
"\"/\"",
",",
"distribution",
".",
"crons_dir",
")",
"config",
".",
"crons",
".",
"map!",
"do",
"|",
"cron_path",
"|",
"Cron",
".",
"new",
"(",
"File",
".",
"expand_path",
"(",
"cron_path"... | Write cron files | [
"Write",
"cron",
"files"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L167-L177 |
17,370 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.package | def package(remaining_attempts = 3)
app_package = Mixlib::ShellOut.new(fpm_command)
app_package.logger = Pkgr.logger
app_package.run_command
app_package.error!
begin
verify
rescue Mixlib::ShellOut::ShellCommandFailed => e
if remaining_attempts > 0
package(re... | ruby | def package(remaining_attempts = 3)
app_package = Mixlib::ShellOut.new(fpm_command)
app_package.logger = Pkgr.logger
app_package.run_command
app_package.error!
begin
verify
rescue Mixlib::ShellOut::ShellCommandFailed => e
if remaining_attempts > 0
package(re... | [
"def",
"package",
"(",
"remaining_attempts",
"=",
"3",
")",
"app_package",
"=",
"Mixlib",
"::",
"ShellOut",
".",
"new",
"(",
"fpm_command",
")",
"app_package",
".",
"logger",
"=",
"Pkgr",
".",
"logger",
"app_package",
".",
"run_command",
"app_package",
".",
... | Launch the FPM command that will generate the package. | [
"Launch",
"the",
"FPM",
"command",
"that",
"will",
"generate",
"the",
"package",
"."
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L181-L195 |
17,371 | crohr/pkgr | lib/pkgr/builder.rb | Pkgr.Builder.buildpacks_for_app | def buildpacks_for_app
raise "#{source_dir} does not exist" unless File.directory?(source_dir)
@buildpacks_for_app ||= begin
mode, buildpacks = distribution.buildpacks
case mode
when :custom
buildpacks.find_all do |buildpack|
buildpack.setup(config.edge, config.... | ruby | def buildpacks_for_app
raise "#{source_dir} does not exist" unless File.directory?(source_dir)
@buildpacks_for_app ||= begin
mode, buildpacks = distribution.buildpacks
case mode
when :custom
buildpacks.find_all do |buildpack|
buildpack.setup(config.edge, config.... | [
"def",
"buildpacks_for_app",
"raise",
"\"#{source_dir} does not exist\"",
"unless",
"File",
".",
"directory?",
"(",
"source_dir",
")",
"@buildpacks_for_app",
"||=",
"begin",
"mode",
",",
"buildpacks",
"=",
"distribution",
".",
"buildpacks",
"case",
"mode",
"when",
":c... | Buildpacks detected for the app, if any. If multiple buildpacks are explicitly specified, all are used | [
"Buildpacks",
"detected",
"for",
"the",
"app",
"if",
"any",
".",
"If",
"multiple",
"buildpacks",
"are",
"explicitly",
"specified",
"all",
"are",
"used"
] | d80c1f1055e428f720123c56e1558b9820ec6fca | https://github.com/crohr/pkgr/blob/d80c1f1055e428f720123c56e1558b9820ec6fca/lib/pkgr/builder.rb#L292-L309 |
17,372 | Jesus/dropbox_api | lib/dropbox_api/options_validator.rb | DropboxApi.OptionsValidator.validate_options | def validate_options(valid_option_keys, options)
options.keys.each do |key|
unless valid_option_keys.include? key.to_sym
raise ArgumentError, "Invalid option `#{key}`"
end
end
end | ruby | def validate_options(valid_option_keys, options)
options.keys.each do |key|
unless valid_option_keys.include? key.to_sym
raise ArgumentError, "Invalid option `#{key}`"
end
end
end | [
"def",
"validate_options",
"(",
"valid_option_keys",
",",
"options",
")",
"options",
".",
"keys",
".",
"each",
"do",
"|",
"key",
"|",
"unless",
"valid_option_keys",
".",
"include?",
"key",
".",
"to_sym",
"raise",
"ArgumentError",
",",
"\"Invalid option `#{key}`\""... | Takes in a list of valid option keys and a hash of options. If one of the
keys in the hash is invalid an ArgumentError will be raised.
@param valid_option_keys List of valid keys for the options hash.
@param options [Hash] Options hash. | [
"Takes",
"in",
"a",
"list",
"of",
"valid",
"option",
"keys",
"and",
"a",
"hash",
"of",
"options",
".",
"If",
"one",
"of",
"the",
"keys",
"in",
"the",
"hash",
"is",
"invalid",
"an",
"ArgumentError",
"will",
"be",
"raised",
"."
] | cc9bc0cbe0ee0035a01cb549822f9edd40797e9d | https://github.com/Jesus/dropbox_api/blob/cc9bc0cbe0ee0035a01cb549822f9edd40797e9d/lib/dropbox_api/options_validator.rb#L8-L14 |
17,373 | Jesus/dropbox_api | lib/dropbox_api/metadata/base.rb | DropboxApi::Metadata.Base.to_hash | def to_hash
Hash[self.class.fields.keys.map do |field_name|
[field_name.to_s, serialized_field(field_name)]
end.select { |k, v| !v.nil? }]
end | ruby | def to_hash
Hash[self.class.fields.keys.map do |field_name|
[field_name.to_s, serialized_field(field_name)]
end.select { |k, v| !v.nil? }]
end | [
"def",
"to_hash",
"Hash",
"[",
"self",
".",
"class",
".",
"fields",
".",
"keys",
".",
"map",
"do",
"|",
"field_name",
"|",
"[",
"field_name",
".",
"to_s",
",",
"serialized_field",
"(",
"field_name",
")",
"]",
"end",
".",
"select",
"{",
"|",
"k",
",",... | Takes in a hash containing all the attributes required to initialize the
object.
Each hash entry should have a key which identifies a field and its value,
so a valid call would be something like this:
DropboxApi::Metadata::File.new({
"name" => "a.jpg",
"path_lower" => "/a.jpg",
"path_disp... | [
"Takes",
"in",
"a",
"hash",
"containing",
"all",
"the",
"attributes",
"required",
"to",
"initialize",
"the",
"object",
"."
] | cc9bc0cbe0ee0035a01cb549822f9edd40797e9d | https://github.com/Jesus/dropbox_api/blob/cc9bc0cbe0ee0035a01cb549822f9edd40797e9d/lib/dropbox_api/metadata/base.rb#L39-L43 |
17,374 | google/google-id-token | lib/google-id-token.rb | GoogleIDToken.Validator.check | def check(token, aud, cid = nil)
synchronize do
payload = check_cached_certs(token, aud, cid)
unless payload
# no certs worked, might've expired, refresh
if refresh_certs
payload = check_cached_certs(token, aud, cid)
unless payload
raise ... | ruby | def check(token, aud, cid = nil)
synchronize do
payload = check_cached_certs(token, aud, cid)
unless payload
# no certs worked, might've expired, refresh
if refresh_certs
payload = check_cached_certs(token, aud, cid)
unless payload
raise ... | [
"def",
"check",
"(",
"token",
",",
"aud",
",",
"cid",
"=",
"nil",
")",
"synchronize",
"do",
"payload",
"=",
"check_cached_certs",
"(",
"token",
",",
"aud",
",",
"cid",
")",
"unless",
"payload",
"# no certs worked, might've expired, refresh",
"if",
"refresh_certs... | If it validates, returns a hash with the JWT payload from the ID Token.
You have to provide an "aud" value, which must match the
token's field with that name, and will similarly check cid if provided.
If something fails, raises an error
@param [String] token
The string form of the token
@param [String] aud
... | [
"If",
"it",
"validates",
"returns",
"a",
"hash",
"with",
"the",
"JWT",
"payload",
"from",
"the",
"ID",
"Token",
".",
"You",
"have",
"to",
"provide",
"an",
"aud",
"value",
"which",
"must",
"match",
"the",
"token",
"s",
"field",
"with",
"that",
"name",
"... | 2cfd6876856995df3d96fa8f3b8e9137526bfb46 | https://github.com/google/google-id-token/blob/2cfd6876856995df3d96fa8f3b8e9137526bfb46/lib/google-id-token.rb#L82-L101 |
17,375 | google/google-id-token | lib/google-id-token.rb | GoogleIDToken.Validator.check_cached_certs | def check_cached_certs(token, aud, cid)
payload = nil
# find first public key that validates this token
@certs.detect do |key, cert|
begin
public_key = cert.public_key
decoded_token = JWT.decode(token, public_key, !!public_key, { :algorithm => 'RS256' })
payload ... | ruby | def check_cached_certs(token, aud, cid)
payload = nil
# find first public key that validates this token
@certs.detect do |key, cert|
begin
public_key = cert.public_key
decoded_token = JWT.decode(token, public_key, !!public_key, { :algorithm => 'RS256' })
payload ... | [
"def",
"check_cached_certs",
"(",
"token",
",",
"aud",
",",
"cid",
")",
"payload",
"=",
"nil",
"# find first public key that validates this token",
"@certs",
".",
"detect",
"do",
"|",
"key",
",",
"cert",
"|",
"begin",
"public_key",
"=",
"cert",
".",
"public_key"... | tries to validate the token against each cached cert.
Returns the token payload or raises a ValidationError or
nil, which means none of the certs validated. | [
"tries",
"to",
"validate",
"the",
"token",
"against",
"each",
"cached",
"cert",
".",
"Returns",
"the",
"token",
"payload",
"or",
"raises",
"a",
"ValidationError",
"or",
"nil",
"which",
"means",
"none",
"of",
"the",
"certs",
"validated",
"."
] | 2cfd6876856995df3d96fa8f3b8e9137526bfb46 | https://github.com/google/google-id-token/blob/2cfd6876856995df3d96fa8f3b8e9137526bfb46/lib/google-id-token.rb#L108-L148 |
17,376 | walle/gimli | lib/gimli/wkhtmltopdf.rb | Gimli.Wkhtmltopdf.output_pdf | def output_pdf(html, filename)
args = command(filename)
invoke = args.join(' ')
IO.popen(invoke, "wb+") do |pdf|
pdf.puts(html)
pdf.close_write
pdf.gets(nil)
end
end | ruby | def output_pdf(html, filename)
args = command(filename)
invoke = args.join(' ')
IO.popen(invoke, "wb+") do |pdf|
pdf.puts(html)
pdf.close_write
pdf.gets(nil)
end
end | [
"def",
"output_pdf",
"(",
"html",
",",
"filename",
")",
"args",
"=",
"command",
"(",
"filename",
")",
"invoke",
"=",
"args",
".",
"join",
"(",
"' '",
")",
"IO",
".",
"popen",
"(",
"invoke",
",",
"\"wb+\"",
")",
"do",
"|",
"pdf",
"|",
"pdf",
".",
... | Set up options for wkhtmltopdf
@param [String] parameters
Convert the html to pdf and write it to file
@param [String] html the html input
@param [String] filename the name of the output file | [
"Set",
"up",
"options",
"for",
"wkhtmltopdf"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/wkhtmltopdf.rb#L15-L24 |
17,377 | walle/gimli | lib/gimli/converter.rb | Gimli.Converter.convert! | def convert!
merged_contents = []
@files.each do |file|
markup = Markup::Renderer.new file, @config.remove_front_matter
html = convert_image_urls markup.render, file.filename
if @config.merge
html = "<div class=\"page-break\"></div>#{html}" unless merged_contents.empty?
... | ruby | def convert!
merged_contents = []
@files.each do |file|
markup = Markup::Renderer.new file, @config.remove_front_matter
html = convert_image_urls markup.render, file.filename
if @config.merge
html = "<div class=\"page-break\"></div>#{html}" unless merged_contents.empty?
... | [
"def",
"convert!",
"merged_contents",
"=",
"[",
"]",
"@files",
".",
"each",
"do",
"|",
"file",
"|",
"markup",
"=",
"Markup",
"::",
"Renderer",
".",
"new",
"file",
",",
"@config",
".",
"remove_front_matter",
"html",
"=",
"convert_image_urls",
"markup",
".",
... | Initialize the converter with a File
@param [Array] files The list of Gimli::MarkupFile to convert (passing a single file will still work)
@param [Gimli::Config] config
Convert the file and save it as a PDF file | [
"Initialize",
"the",
"converter",
"with",
"a",
"File"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/converter.rb#L29-L47 |
17,378 | walle/gimli | lib/gimli/converter.rb | Gimli.Converter.convert_image_urls | def convert_image_urls(html, filename)
dir_string = ::File.dirname(::File.expand_path(filename))
html.scan(/<img[^>]+src="([^"]+)"/).each do |url|
html.gsub!(url[0], ::File.expand_path(url[0], dir_string)) unless url[0] =~ /^https?/
end
html
end | ruby | def convert_image_urls(html, filename)
dir_string = ::File.dirname(::File.expand_path(filename))
html.scan(/<img[^>]+src="([^"]+)"/).each do |url|
html.gsub!(url[0], ::File.expand_path(url[0], dir_string)) unless url[0] =~ /^https?/
end
html
end | [
"def",
"convert_image_urls",
"(",
"html",
",",
"filename",
")",
"dir_string",
"=",
"::",
"File",
".",
"dirname",
"(",
"::",
"File",
".",
"expand_path",
"(",
"filename",
")",
")",
"html",
".",
"scan",
"(",
"/",
"/",
")",
".",
"each",
"do",
"|",
"url",... | Rewrite relative image urls to absolute
@param [String] html some html to parse
@return [String] the html with all image urls replaced to absolute | [
"Rewrite",
"relative",
"image",
"urls",
"to",
"absolute"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/converter.rb#L52-L59 |
17,379 | walle/gimli | lib/gimli/converter.rb | Gimli.Converter.output_pdf | def output_pdf(html, filename)
html = add_head html
load_stylesheets
generate_cover!
append_stylesheets html
puts @wkhtmltopdf.command(output_file(filename)).join(' ') if @config.debug
@wkhtmltopdf.output_pdf html, output_file(filename)
end | ruby | def output_pdf(html, filename)
html = add_head html
load_stylesheets
generate_cover!
append_stylesheets html
puts @wkhtmltopdf.command(output_file(filename)).join(' ') if @config.debug
@wkhtmltopdf.output_pdf html, output_file(filename)
end | [
"def",
"output_pdf",
"(",
"html",
",",
"filename",
")",
"html",
"=",
"add_head",
"html",
"load_stylesheets",
"generate_cover!",
"append_stylesheets",
"html",
"puts",
"@wkhtmltopdf",
".",
"command",
"(",
"output_file",
"(",
"filename",
")",
")",
".",
"join",
"(",... | Create the pdf
@param [String] html the html input
@param [String] filename the name of the output file | [
"Create",
"the",
"pdf"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/converter.rb#L64-L71 |
17,380 | walle/gimli | lib/gimli/converter.rb | Gimli.Converter.load_stylesheets | def load_stylesheets
# Load standard stylesheet
style = ::File.expand_path("../../../config/style.css", __FILE__)
@stylesheets << style
@stylesheets << stylesheet if ::File.exists?(stylesheet)
end | ruby | def load_stylesheets
# Load standard stylesheet
style = ::File.expand_path("../../../config/style.css", __FILE__)
@stylesheets << style
@stylesheets << stylesheet if ::File.exists?(stylesheet)
end | [
"def",
"load_stylesheets",
"# Load standard stylesheet",
"style",
"=",
"::",
"File",
".",
"expand_path",
"(",
"\"../../../config/style.css\"",
",",
"__FILE__",
")",
"@stylesheets",
"<<",
"style",
"@stylesheets",
"<<",
"stylesheet",
"if",
"::",
"File",
".",
"exists?",
... | Load the stylesheets to pdfkit loads the default and the user selected if any | [
"Load",
"the",
"stylesheets",
"to",
"pdfkit",
"loads",
"the",
"default",
"and",
"the",
"user",
"selected",
"if",
"any"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/converter.rb#L78-L83 |
17,381 | walle/gimli | lib/gimli/converter.rb | Gimli.Converter.output_file | def output_file(file = nil)
if file
output_filename = file.name
if !@config.output_filename.nil? && @files.length == 1
output_filename = @config.output_filename
end
else
output_filename = Time.now.to_s.split(' ').join('_')
output_filename = @files.last.name ... | ruby | def output_file(file = nil)
if file
output_filename = file.name
if !@config.output_filename.nil? && @files.length == 1
output_filename = @config.output_filename
end
else
output_filename = Time.now.to_s.split(' ').join('_')
output_filename = @files.last.name ... | [
"def",
"output_file",
"(",
"file",
"=",
"nil",
")",
"if",
"file",
"output_filename",
"=",
"file",
".",
"name",
"if",
"!",
"@config",
".",
"output_filename",
".",
"nil?",
"&&",
"@files",
".",
"length",
"==",
"1",
"output_filename",
"=",
"@config",
".",
"o... | Generate the name of the output file
@return [String]
@param [Gimli::MarkupFile] file optionally, specify a file, otherwise use output filename | [
"Generate",
"the",
"name",
"of",
"the",
"output",
"file"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/converter.rb#L112-L125 |
17,382 | walle/gimli | lib/gimli/converter.rb | Gimli.Converter.generate_cover! | def generate_cover!
return unless @config.cover
cover_file = MarkupFile.new @config.cover
markup = Markup::Renderer.new cover_file
html = "<div class=\"cover\">\n#{markup.render}\n</div>"
append_stylesheets(html)
html = add_head(html)
@coverfile.write(html)
@coverfile.clo... | ruby | def generate_cover!
return unless @config.cover
cover_file = MarkupFile.new @config.cover
markup = Markup::Renderer.new cover_file
html = "<div class=\"cover\">\n#{markup.render}\n</div>"
append_stylesheets(html)
html = add_head(html)
@coverfile.write(html)
@coverfile.clo... | [
"def",
"generate_cover!",
"return",
"unless",
"@config",
".",
"cover",
"cover_file",
"=",
"MarkupFile",
".",
"new",
"@config",
".",
"cover",
"markup",
"=",
"Markup",
"::",
"Renderer",
".",
"new",
"cover_file",
"html",
"=",
"\"<div class=\\\"cover\\\">\\n#{markup.ren... | Generate cover file if optional cover was given | [
"Generate",
"cover",
"file",
"if",
"optional",
"cover",
"was",
"given"
] | 17f46bb860545ae155f93bc29c55c7487d29169b | https://github.com/walle/gimli/blob/17f46bb860545ae155f93bc29c55c7487d29169b/lib/gimli/converter.rb#L128-L137 |
17,383 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.find_events_in_range | def find_events_in_range(start_min, start_max, options = {})
formatted_start_min = encode_time(start_min)
formatted_start_max = encode_time(start_max)
query = "?timeMin=#{formatted_start_min}&timeMax=#{formatted_start_max}#{parse_options(options)}"
event_lookup(query)
end | ruby | def find_events_in_range(start_min, start_max, options = {})
formatted_start_min = encode_time(start_min)
formatted_start_max = encode_time(start_max)
query = "?timeMin=#{formatted_start_min}&timeMax=#{formatted_start_max}#{parse_options(options)}"
event_lookup(query)
end | [
"def",
"find_events_in_range",
"(",
"start_min",
",",
"start_max",
",",
"options",
"=",
"{",
"}",
")",
"formatted_start_min",
"=",
"encode_time",
"(",
"start_min",
")",
"formatted_start_max",
"=",
"encode_time",
"(",
"start_max",
")",
"query",
"=",
"\"?timeMin=#{f... | Find all of the events associated with this calendar that start in the given time frame.
The lower bound is inclusive, whereas the upper bound is exclusive.
Events that overlap the range are included.
the +options+ parameter accepts
:max_results => the maximum number of results to return defaults to 25 the largest... | [
"Find",
"all",
"of",
"the",
"events",
"associated",
"with",
"this",
"calendar",
"that",
"start",
"in",
"the",
"given",
"time",
"frame",
".",
"The",
"lower",
"bound",
"is",
"inclusive",
"whereas",
"the",
"upper",
"bound",
"is",
"exclusive",
".",
"Events",
"... | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L260-L265 |
17,384 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.find_events_by_extended_properties | def find_events_by_extended_properties(extended_properties, options = {})
query = "?" + parse_extended_properties(extended_properties) + parse_options(options)
event_lookup(query)
end | ruby | def find_events_by_extended_properties(extended_properties, options = {})
query = "?" + parse_extended_properties(extended_properties) + parse_options(options)
event_lookup(query)
end | [
"def",
"find_events_by_extended_properties",
"(",
"extended_properties",
",",
"options",
"=",
"{",
"}",
")",
"query",
"=",
"\"?\"",
"+",
"parse_extended_properties",
"(",
"extended_properties",
")",
"+",
"parse_options",
"(",
"options",
")",
"event_lookup",
"(",
"qu... | Find all events that match at least one of the specified extended properties.
the +extended_properties+ parameter is set up the same way that it is configured when creating an event
for example, providing the following hash { 'shared' => {'p1' => 'v1', 'p2' => v2} } will return the list of events
that contain eithe... | [
"Find",
"all",
"events",
"that",
"match",
"at",
"least",
"one",
"of",
"the",
"specified",
"extended",
"properties",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L303-L306 |
17,385 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.find_events_by_extended_properties_in_range | def find_events_by_extended_properties_in_range(extended_properties, start_min, start_max, options = {})
formatted_start_min = encode_time(start_min)
formatted_start_max = encode_time(start_max)
base_query = parse_extended_properties(extended_properties) + parse_options(options)
query = "?" + ba... | ruby | def find_events_by_extended_properties_in_range(extended_properties, start_min, start_max, options = {})
formatted_start_min = encode_time(start_min)
formatted_start_max = encode_time(start_max)
base_query = parse_extended_properties(extended_properties) + parse_options(options)
query = "?" + ba... | [
"def",
"find_events_by_extended_properties_in_range",
"(",
"extended_properties",
",",
"start_min",
",",
"start_max",
",",
"options",
"=",
"{",
"}",
")",
"formatted_start_min",
"=",
"encode_time",
"(",
"start_min",
")",
"formatted_start_max",
"=",
"encode_time",
"(",
... | Find all events that match at least one of the specified extended properties within a given time frame.
The lower bound is inclusive, whereas the upper bound is exclusive.
Events that overlap the range are included.
the +extended_properties+ parameter is set up the same way that it is configured when creating an ev... | [
"Find",
"all",
"events",
"that",
"match",
"at",
"least",
"one",
"of",
"the",
"specified",
"extended",
"properties",
"within",
"a",
"given",
"time",
"frame",
".",
"The",
"lower",
"bound",
"is",
"inclusive",
"whereas",
"the",
"upper",
"bound",
"is",
"exclusive... | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L327-L333 |
17,386 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.find_or_create_event_by_id | def find_or_create_event_by_id(id, &blk)
event = id ? find_event_by_id(id)[0] : nil
if event
setup_event(event, &blk)
elsif id
event = Event.new(id: id, new_event_with_id_specified: true)
setup_event(event, &blk)
else
event = Event.new
setup_event(e... | ruby | def find_or_create_event_by_id(id, &blk)
event = id ? find_event_by_id(id)[0] : nil
if event
setup_event(event, &blk)
elsif id
event = Event.new(id: id, new_event_with_id_specified: true)
setup_event(event, &blk)
else
event = Event.new
setup_event(e... | [
"def",
"find_or_create_event_by_id",
"(",
"id",
",",
"&",
"blk",
")",
"event",
"=",
"id",
"?",
"find_event_by_id",
"(",
"id",
")",
"[",
"0",
"]",
":",
"nil",
"if",
"event",
"setup_event",
"(",
"event",
",",
"blk",
")",
"elsif",
"id",
"event",
"=",
"E... | Looks for the specified event id.
If it is found it, updates it's vales and returns it.
If the event is no longer on the server it creates a new one with the specified values.
Works like the create_event method. | [
"Looks",
"for",
"the",
"specified",
"event",
"id",
".",
"If",
"it",
"is",
"found",
"it",
"updates",
"it",
"s",
"vales",
"and",
"returns",
"it",
".",
"If",
"the",
"event",
"is",
"no",
"longer",
"on",
"the",
"server",
"it",
"creates",
"a",
"new",
"one"... | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L374-L386 |
17,387 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.save_event | def save_event(event)
method = event.new_event? ? :post : :put
body = event.use_quickadd? ? nil : event.to_json
notifications = "sendNotifications=#{event.send_notifications?}"
query_string = if event.use_quickadd?
"/quickAdd?#{notifications}&text=#{event.title}"
... | ruby | def save_event(event)
method = event.new_event? ? :post : :put
body = event.use_quickadd? ? nil : event.to_json
notifications = "sendNotifications=#{event.send_notifications?}"
query_string = if event.use_quickadd?
"/quickAdd?#{notifications}&text=#{event.title}"
... | [
"def",
"save_event",
"(",
"event",
")",
"method",
"=",
"event",
".",
"new_event?",
"?",
":post",
":",
":put",
"body",
"=",
"event",
".",
"use_quickadd?",
"?",
"nil",
":",
"event",
".",
"to_json",
"notifications",
"=",
"\"sendNotifications=#{event.send_notificati... | Saves the specified event.
This is a callback used by the Event class. | [
"Saves",
"the",
"specified",
"event",
".",
"This",
"is",
"a",
"callback",
"used",
"by",
"the",
"Event",
"class",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L392-L405 |
17,388 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.parse_options | def parse_options(options) # :nodoc
options[:max_results] ||= 25
options[:order_by] ||= 'startTime' # other option is 'updated'
options[:expand_recurring_events] ||= true
query_string = "&orderBy=#{options[:order_by]}"
query_string << "&maxResults=#{options[:max_results]}"
query_str... | ruby | def parse_options(options) # :nodoc
options[:max_results] ||= 25
options[:order_by] ||= 'startTime' # other option is 'updated'
options[:expand_recurring_events] ||= true
query_string = "&orderBy=#{options[:order_by]}"
query_string << "&maxResults=#{options[:max_results]}"
query_str... | [
"def",
"parse_options",
"(",
"options",
")",
"# :nodoc",
"options",
"[",
":max_results",
"]",
"||=",
"25",
"options",
"[",
":order_by",
"]",
"||=",
"'startTime'",
"# other option is 'updated'",
"options",
"[",
":expand_recurring_events",
"]",
"||=",
"true",
"query_s... | Utility method used to centralize the parsing of common query parameters. | [
"Utility",
"method",
"used",
"to",
"centralize",
"the",
"parsing",
"of",
"common",
"query",
"parameters",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L433-L442 |
17,389 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.parse_extended_properties | def parse_extended_properties(extended_properties) # :nodoc
query_parts = []
['shared', 'private'].each do |prop_type|
next unless extended_properties[prop_type]
query_parts << extended_properties[prop_type].map {|key, value| (prop_type == "shared" ? "sharedExtendedProperty=" : "privateExten... | ruby | def parse_extended_properties(extended_properties) # :nodoc
query_parts = []
['shared', 'private'].each do |prop_type|
next unless extended_properties[prop_type]
query_parts << extended_properties[prop_type].map {|key, value| (prop_type == "shared" ? "sharedExtendedProperty=" : "privateExten... | [
"def",
"parse_extended_properties",
"(",
"extended_properties",
")",
"# :nodoc",
"query_parts",
"=",
"[",
"]",
"[",
"'shared'",
",",
"'private'",
"]",
".",
"each",
"do",
"|",
"prop_type",
"|",
"next",
"unless",
"extended_properties",
"[",
"prop_type",
"]",
"quer... | Utility method used to centralize the parsing of extended query parameters. | [
"Utility",
"method",
"used",
"to",
"centralize",
"the",
"parsing",
"of",
"extended",
"query",
"parameters",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L447-L454 |
17,390 | northworld/google_calendar | lib/google/calendar.rb | Google.Calendar.event_lookup | def event_lookup(query_string = '') #:nodoc:
begin
response = send_events_request(query_string, :get)
parsed_json = JSON.parse(response.body)
@summary = parsed_json['summary']
events = Event.build_from_google_feed(parsed_json, self) || []
return events if events.empty?
... | ruby | def event_lookup(query_string = '') #:nodoc:
begin
response = send_events_request(query_string, :get)
parsed_json = JSON.parse(response.body)
@summary = parsed_json['summary']
events = Event.build_from_google_feed(parsed_json, self) || []
return events if events.empty?
... | [
"def",
"event_lookup",
"(",
"query_string",
"=",
"''",
")",
"#:nodoc:",
"begin",
"response",
"=",
"send_events_request",
"(",
"query_string",
",",
":get",
")",
"parsed_json",
"=",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"@summary",
"=",
"par... | Utility method used to centralize event lookup. | [
"Utility",
"method",
"used",
"to",
"centralize",
"event",
"lookup",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar.rb#L466-L477 |
17,391 | northworld/google_calendar | lib/google/freebusy.rb | Google.Freebusy.json_for_query | def json_for_query(calendar_ids, start_time, end_time)
{}.tap{ |obj|
obj[:items] = calendar_ids.map {|id| Hash[:id, id] }
obj[:timeMin] = start_time.utc.iso8601
obj[:timeMax] = end_time.utc.iso8601
}.to_json
end | ruby | def json_for_query(calendar_ids, start_time, end_time)
{}.tap{ |obj|
obj[:items] = calendar_ids.map {|id| Hash[:id, id] }
obj[:timeMin] = start_time.utc.iso8601
obj[:timeMax] = end_time.utc.iso8601
}.to_json
end | [
"def",
"json_for_query",
"(",
"calendar_ids",
",",
"start_time",
",",
"end_time",
")",
"{",
"}",
".",
"tap",
"{",
"|",
"obj",
"|",
"obj",
"[",
":items",
"]",
"=",
"calendar_ids",
".",
"map",
"{",
"|",
"id",
"|",
"Hash",
"[",
":id",
",",
"id",
"]",
... | Prepare the JSON | [
"Prepare",
"the",
"JSON"
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/freebusy.rb#L51-L57 |
17,392 | northworld/google_calendar | lib/google/connection.rb | Google.Connection.send | def send(path, method, content = '')
uri = BASE_URI + path
response = @client.fetch_protected_resource(
:uri => uri,
:method => method,
:body => content,
:headers => {'Content-type' => 'application/json'}
)
check_for_errors(response)
return response
... | ruby | def send(path, method, content = '')
uri = BASE_URI + path
response = @client.fetch_protected_resource(
:uri => uri,
:method => method,
:body => content,
:headers => {'Content-type' => 'application/json'}
)
check_for_errors(response)
return response
... | [
"def",
"send",
"(",
"path",
",",
"method",
",",
"content",
"=",
"''",
")",
"uri",
"=",
"BASE_URI",
"+",
"path",
"response",
"=",
"@client",
".",
"fetch_protected_resource",
"(",
":uri",
"=>",
"uri",
",",
":method",
"=>",
"method",
",",
":body",
"=>",
"... | Send a request to google. | [
"Send",
"a",
"request",
"to",
"google",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/connection.rb#L126-L139 |
17,393 | northworld/google_calendar | lib/google/connection.rb | Google.Connection.parse_403_error | def parse_403_error(response)
case JSON.parse(response.body)["error"]["message"]
when "Forbidden" then raise ForbiddenError, response.body
when "Daily Limit Exceeded" then raise DailyLimitExceededError, response.body
when "User Rate Limit Exceeded" ... | ruby | def parse_403_error(response)
case JSON.parse(response.body)["error"]["message"]
when "Forbidden" then raise ForbiddenError, response.body
when "Daily Limit Exceeded" then raise DailyLimitExceededError, response.body
when "User Rate Limit Exceeded" ... | [
"def",
"parse_403_error",
"(",
"response",
")",
"case",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"[",
"\"error\"",
"]",
"[",
"\"message\"",
"]",
"when",
"\"Forbidden\"",
"then",
"raise",
"ForbiddenError",
",",
"response",
".",
"body",
"when",... | Utility method to centralize handling of 403 errors. | [
"Utility",
"method",
"to",
"centralize",
"handling",
"of",
"403",
"errors",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/connection.rb#L173-L182 |
17,394 | northworld/google_calendar | lib/google/event.rb | Google.Event.all_day? | def all_day?
time = (@start_time.is_a? String) ? Time.parse(@start_time) : @start_time.dup.utc
duration % (24 * 60 * 60) == 0 && time == Time.local(time.year,time.month,time.day)
end | ruby | def all_day?
time = (@start_time.is_a? String) ? Time.parse(@start_time) : @start_time.dup.utc
duration % (24 * 60 * 60) == 0 && time == Time.local(time.year,time.month,time.day)
end | [
"def",
"all_day?",
"time",
"=",
"(",
"@start_time",
".",
"is_a?",
"String",
")",
"?",
"Time",
".",
"parse",
"(",
"@start_time",
")",
":",
"@start_time",
".",
"dup",
".",
"utc",
"duration",
"%",
"(",
"24",
"*",
"60",
"*",
"60",
")",
"==",
"0",
"&&",... | Returns whether the Event is an all-day event, based on whether the event starts at the beginning and ends at the end of the day. | [
"Returns",
"whether",
"the",
"Event",
"is",
"an",
"all",
"-",
"day",
"event",
"based",
"on",
"whether",
"the",
"event",
"starts",
"at",
"the",
"beginning",
"and",
"ends",
"at",
"the",
"end",
"of",
"the",
"day",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/event.rb#L122-L125 |
17,395 | northworld/google_calendar | lib/google/event.rb | Google.Event.to_json | def to_json
attributes = {
"summary" => title,
"visibility" => visibility,
"transparency" => transparency,
"description" => description,
"location" => location,
"start" => time_or_all_day(start_time),
"end" => time_or_all_day(end_time),
"reminders" =... | ruby | def to_json
attributes = {
"summary" => title,
"visibility" => visibility,
"transparency" => transparency,
"description" => description,
"location" => location,
"start" => time_or_all_day(start_time),
"end" => time_or_all_day(end_time),
"reminders" =... | [
"def",
"to_json",
"attributes",
"=",
"{",
"\"summary\"",
"=>",
"title",
",",
"\"visibility\"",
"=>",
"visibility",
",",
"\"transparency\"",
"=>",
"transparency",
",",
"\"description\"",
"=>",
"description",
",",
"\"location\"",
"=>",
"location",
",",
"\"start\"",
... | Google JSON representation of an event object. | [
"Google",
"JSON",
"representation",
"of",
"an",
"event",
"object",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/event.rb#L264-L293 |
17,396 | northworld/google_calendar | lib/google/event.rb | Google.Event.attendees_attributes | def attendees_attributes
return {} unless @attendees
attendees = @attendees.map do |attendee|
attendee.select { |k,_v| ['displayName', 'email', 'responseStatus'].include?(k) }
end
{ "attendees" => attendees }
end | ruby | def attendees_attributes
return {} unless @attendees
attendees = @attendees.map do |attendee|
attendee.select { |k,_v| ['displayName', 'email', 'responseStatus'].include?(k) }
end
{ "attendees" => attendees }
end | [
"def",
"attendees_attributes",
"return",
"{",
"}",
"unless",
"@attendees",
"attendees",
"=",
"@attendees",
".",
"map",
"do",
"|",
"attendee",
"|",
"attendee",
".",
"select",
"{",
"|",
"k",
",",
"_v",
"|",
"[",
"'displayName'",
",",
"'email'",
",",
"'respon... | Hash representation of attendees | [
"Hash",
"representation",
"of",
"attendees"
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/event.rb#L313-L321 |
17,397 | northworld/google_calendar | lib/google/event.rb | Google.Event.local_timezone_attributes | def local_timezone_attributes
tz = Time.now.getlocal.zone
tz_name = TimezoneParser::getTimezones(tz).last
{ "timeZone" => tz_name }
end | ruby | def local_timezone_attributes
tz = Time.now.getlocal.zone
tz_name = TimezoneParser::getTimezones(tz).last
{ "timeZone" => tz_name }
end | [
"def",
"local_timezone_attributes",
"tz",
"=",
"Time",
".",
"now",
".",
"getlocal",
".",
"zone",
"tz_name",
"=",
"TimezoneParser",
"::",
"getTimezones",
"(",
"tz",
")",
".",
"last",
"{",
"\"timeZone\"",
"=>",
"tz_name",
"}",
"end"
] | Hash representation of local timezone | [
"Hash",
"representation",
"of",
"local",
"timezone"
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/event.rb#L359-L363 |
17,398 | northworld/google_calendar | lib/google/event.rb | Google.Event.recurrence_attributes | def recurrence_attributes
return {} unless is_recurring_event?
@recurrence[:until] = @recurrence[:until].strftime('%Y%m%dT%H%M%SZ') if @recurrence[:until]
rrule = "RRULE:" + @recurrence.collect { |k,v| "#{k}=#{v}" }.join(';').upcase
@recurrence[:until] = Time.parse(@recurrence[:until]) if @recu... | ruby | def recurrence_attributes
return {} unless is_recurring_event?
@recurrence[:until] = @recurrence[:until].strftime('%Y%m%dT%H%M%SZ') if @recurrence[:until]
rrule = "RRULE:" + @recurrence.collect { |k,v| "#{k}=#{v}" }.join(';').upcase
@recurrence[:until] = Time.parse(@recurrence[:until]) if @recu... | [
"def",
"recurrence_attributes",
"return",
"{",
"}",
"unless",
"is_recurring_event?",
"@recurrence",
"[",
":until",
"]",
"=",
"@recurrence",
"[",
":until",
"]",
".",
"strftime",
"(",
"'%Y%m%dT%H%M%SZ'",
")",
"if",
"@recurrence",
"[",
":until",
"]",
"rrule",
"=",
... | Hash representation of recurrence rules for repeating events | [
"Hash",
"representation",
"of",
"recurrence",
"rules",
"for",
"repeating",
"events"
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/event.rb#L375-L383 |
17,399 | northworld/google_calendar | lib/google/calendar_list.rb | Google.CalendarList.fetch_entries | def fetch_entries
response = @connection.send("/users/me/calendarList", :get)
return nil if response.status != 200 || response.body.empty?
CalendarListEntry.build_from_google_feed(JSON.parse(response.body), @connection)
end | ruby | def fetch_entries
response = @connection.send("/users/me/calendarList", :get)
return nil if response.status != 200 || response.body.empty?
CalendarListEntry.build_from_google_feed(JSON.parse(response.body), @connection)
end | [
"def",
"fetch_entries",
"response",
"=",
"@connection",
".",
"send",
"(",
"\"/users/me/calendarList\"",
",",
":get",
")",
"return",
"nil",
"if",
"response",
".",
"status",
"!=",
"200",
"||",
"response",
".",
"body",
".",
"empty?",
"CalendarListEntry",
".",
"bu... | Setup and connect to the user's list of Google Calendars.
The +params+ parameter accepts
* :client_id => the client ID that you received from Google after registering your application with them (https://console.developers.google.com/). REQUIRED
* :client_secret => the client secret you received from Google after re... | [
"Setup",
"and",
"connect",
"to",
"the",
"user",
"s",
"list",
"of",
"Google",
"Calendars",
"."
] | a81d685e432ce6c7e1838d14166fb1d5bab39685 | https://github.com/northworld/google_calendar/blob/a81d685e432ce6c7e1838d14166fb1d5bab39685/lib/google/calendar_list.rb#L28-L34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.