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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.close! | def close!
unless @edges.empty?
# NOTE: parallel? is use here instead of collinear? because the
# edges are connected, and will therefore be collinear if
# they're parallel
if closed?
if @edges.first.parallel?(@edges.last)
unshift_edge Edge.new(@edges.last.first, shift_edge.last)
end
elsi... | ruby | def close!
unless @edges.empty?
# NOTE: parallel? is use here instead of collinear? because the
# edges are connected, and will therefore be collinear if
# they're parallel
if closed?
if @edges.first.parallel?(@edges.last)
unshift_edge Edge.new(@edges.last.first, shift_edge.last)
end
elsi... | [
"def",
"close!",
"unless",
"@edges",
".",
"empty?",
"if",
"closed?",
"if",
"@edges",
".",
"first",
".",
"parallel?",
"(",
"@edges",
".",
"last",
")",
"unshift_edge",
"Edge",
".",
"new",
"(",
"@edges",
".",
"last",
".",
"first",
",",
"shift_edge",
".",
... | Close the receiver and return it
@return [Polyline] the receiver after closing | [
"Close",
"the",
"receiver",
"and",
"return",
"it"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L127-L159 | train |
bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.bisector_map | def bisector_map
winding = 0
tangent_loop.each_cons(2).map do |v1,v2|
k = v1[0]*v2[1] - v1[1]*v2[0] # z-component of v1 x v2
winding += k
if v1 == v2 # collinear, same direction?
bisector = Vector[-v1[1], v1[0]]
block_given? ? (bisector * yield(bisector, 1)) : bisector
elsif 0 == k # c... | ruby | def bisector_map
winding = 0
tangent_loop.each_cons(2).map do |v1,v2|
k = v1[0]*v2[1] - v1[1]*v2[0] # z-component of v1 x v2
winding += k
if v1 == v2 # collinear, same direction?
bisector = Vector[-v1[1], v1[0]]
block_given? ? (bisector * yield(bisector, 1)) : bisector
elsif 0 == k # c... | [
"def",
"bisector_map",
"winding",
"=",
"0",
"tangent_loop",
".",
"each_cons",
"(",
"2",
")",
".",
"map",
"do",
"|",
"v1",
",",
"v2",
"|",
"k",
"=",
"v1",
"[",
"0",
"]",
"*",
"v2",
"[",
"1",
"]",
"-",
"v1",
"[",
"1",
"]",
"*",
"v2",
"[",
"0"... | Generate bisectors and k values with an optional mapping block
@note If the {Polyline} isn't closed (the normal case), then the first and
last vertices will be given bisectors that are perpendicular to themselves.
@return [Array<Vector>] the unit {Vector}s representing the angle bisector of each vertex | [
"Generate",
"bisectors",
"and",
"k",
"values",
"with",
"an",
"optional",
"mapping",
"block"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L281-L304 | train |
bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.tangent_loop | def tangent_loop
edges.map {|e| e.direction }.tap do |tangents|
# Generating a bisector for each vertex requires an edge on both sides of each vertex.
# Obviously, the first and last vertices each have only a single adjacent edge, unless the
# Polyline happens to be closed (like a Polygon). When not closed, ... | ruby | def tangent_loop
edges.map {|e| e.direction }.tap do |tangents|
# Generating a bisector for each vertex requires an edge on both sides of each vertex.
# Obviously, the first and last vertices each have only a single adjacent edge, unless the
# Polyline happens to be closed (like a Polygon). When not closed, ... | [
"def",
"tangent_loop",
"edges",
".",
"map",
"{",
"|",
"e",
"|",
"e",
".",
"direction",
"}",
".",
"tap",
"do",
"|",
"tangents",
"|",
"if",
"closed?",
"tangents",
".",
"unshift",
"tangents",
".",
"last",
"else",
"tangents",
".",
"unshift",
"(",
"tangents... | Generate the tangents and fake a circular buffer while accounting for closedness
@return [Array<Vector>] the tangents | [
"Generate",
"the",
"tangents",
"and",
"fake",
"a",
"circular",
"buffer",
"while",
"accounting",
"for",
"closedness"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L317-L333 | train |
bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.find_next_intersection | def find_next_intersection(edges, i, e)
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
intersection = e.intersection(e2)
return [intersection, j] if intersection
end
nil
end | ruby | def find_next_intersection(edges, i, e)
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
intersection = e.intersection(e2)
return [intersection, j] if intersection
end
nil
end | [
"def",
"find_next_intersection",
"(",
"edges",
",",
"i",
",",
"e",
")",
"for",
"j",
"in",
"i",
"..",
"(",
"edges",
".",
"count",
"-",
"1",
")",
"e2",
"=",
"edges",
"[",
"j",
"]",
"[",
":edge",
"]",
"next",
"if",
"!",
"e2",
"||",
"e",
".",
"co... | Find the next edge that intersects with e, starting at index i | [
"Find",
"the",
"next",
"edge",
"that",
"intersects",
"with",
"e",
"starting",
"at",
"index",
"i"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L336-L344 | train |
bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.find_last_intersection | def find_last_intersection(edges, i, e)
intersection, intersection_at = nil, nil
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
_intersection = e.intersection(e2)
intersection, intersection_at = _intersection, j if _intersection
end
[intersection, intersecti... | ruby | def find_last_intersection(edges, i, e)
intersection, intersection_at = nil, nil
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
_intersection = e.intersection(e2)
intersection, intersection_at = _intersection, j if _intersection
end
[intersection, intersecti... | [
"def",
"find_last_intersection",
"(",
"edges",
",",
"i",
",",
"e",
")",
"intersection",
",",
"intersection_at",
"=",
"nil",
",",
"nil",
"for",
"j",
"in",
"i",
"..",
"(",
"edges",
".",
"count",
"-",
"1",
")",
"e2",
"=",
"edges",
"[",
"j",
"]",
"[",
... | Find the last edge that intersects with e, starting at index i | [
"Find",
"the",
"last",
"edge",
"that",
"intersects",
"with",
"e",
"starting",
"at",
"index",
"i"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L347-L356 | train |
paddor/cztop | lib/cztop/config.rb | CZTop.Config.[] | def [](path, default = "")
ptr = ffi_delegate.get(path, default)
return nil if ptr.null?
ptr.read_string
end | ruby | def [](path, default = "")
ptr = ffi_delegate.get(path, default)
return nil if ptr.null?
ptr.read_string
end | [
"def",
"[]",
"(",
"path",
",",
"default",
"=",
"\"\"",
")",
"ptr",
"=",
"ffi_delegate",
".",
"get",
"(",
"path",
",",
"default",
")",
"return",
"nil",
"if",
"ptr",
".",
"null?",
"ptr",
".",
"read_string",
"end"
] | Get the value of the current config item.
@param path [String, #to_s] path to config item
@param default [String, #to_s] default value to return if config item
doesn't exist
@return [String]
@return [default] if config item doesn't exist
@note The default value is not returned when the config item exists but
... | [
"Get",
"the",
"value",
"of",
"the",
"current",
"config",
"item",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/config.rb#L95-L99 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/xmlrpc/create.rb | XMLRPC.Create.methodResponse | def methodResponse(is_ret, *params)
if is_ret
resp = params.collect do |param|
@writer.ele("param", conv2value(param))
end
resp = [@writer.ele("params", *resp)]
else
if params.size != 1 or params[0] === XMLRPC::FaultException
raise ArgumentError, "no val... | ruby | def methodResponse(is_ret, *params)
if is_ret
resp = params.collect do |param|
@writer.ele("param", conv2value(param))
end
resp = [@writer.ele("params", *resp)]
else
if params.size != 1 or params[0] === XMLRPC::FaultException
raise ArgumentError, "no val... | [
"def",
"methodResponse",
"(",
"is_ret",
",",
"*",
"params",
")",
"if",
"is_ret",
"resp",
"=",
"params",
".",
"collect",
"do",
"|",
"param",
"|",
"@writer",
".",
"ele",
"(",
"\"param\"",
",",
"conv2value",
"(",
"param",
")",
")",
"end",
"resp",
"=",
"... | generates a XML-RPC methodResponse document
if is_ret == false then the params array must
contain only one element, which is a structure
of a fault return-value.
if is_ret == true then a normal
return-value of all the given params is created. | [
"generates",
"a",
"XML",
"-",
"RPC",
"methodResponse",
"document"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/xmlrpc/create.rb#L144-L166 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/fragments.rb | SM.LineCollection.add_list_start_and_ends | def add_list_start_and_ends
level = 0
res = []
type_stack = []
@fragments.each do |fragment|
# $stderr.puts "#{level} : #{fragment.class.name} : #{fragment.level}"
new_level = fragment.level
while (level < new_level)
level += 1
type = fragment.type
... | ruby | def add_list_start_and_ends
level = 0
res = []
type_stack = []
@fragments.each do |fragment|
# $stderr.puts "#{level} : #{fragment.class.name} : #{fragment.level}"
new_level = fragment.level
while (level < new_level)
level += 1
type = fragment.type
... | [
"def",
"add_list_start_and_ends",
"level",
"=",
"0",
"res",
"=",
"[",
"]",
"type_stack",
"=",
"[",
"]",
"@fragments",
".",
"each",
"do",
"|",
"fragment",
"|",
"new_level",
"=",
"fragment",
".",
"level",
"while",
"(",
"level",
"<",
"new_level",
")",
"leve... | List nesting is implicit given the level of
Make it explicit, just to make life a tad
easier for the output processors | [
"List",
"nesting",
"is",
"implicit",
"given",
"the",
"level",
"of",
"Make",
"it",
"explicit",
"just",
"to",
"make",
"life",
"a",
"tad",
"easier",
"for",
"the",
"output",
"processors"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/fragments.rb#L239-L271 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/packagetask.rb | Rake.PackageTask.init | def init(name, version)
@name = name
@version = version
@package_files = Rake::FileList.new
@package_dir = 'pkg'
@need_tar = false
@need_tar_gz = false
@need_tar_bz2 = false
@need_zip = false
@tar_command = 'tar'
@zip_command = 'zip'
end | ruby | def init(name, version)
@name = name
@version = version
@package_files = Rake::FileList.new
@package_dir = 'pkg'
@need_tar = false
@need_tar_gz = false
@need_tar_bz2 = false
@need_zip = false
@tar_command = 'tar'
@zip_command = 'zip'
end | [
"def",
"init",
"(",
"name",
",",
"version",
")",
"@name",
"=",
"name",
"@version",
"=",
"version",
"@package_files",
"=",
"Rake",
"::",
"FileList",
".",
"new",
"@package_dir",
"=",
"'pkg'",
"@need_tar",
"=",
"false",
"@need_tar_gz",
"=",
"false",
"@need_tar_... | Create a Package Task with the given name and version.
Initialization that bypasses the "yield self" and "define" step. | [
"Create",
"a",
"Package",
"Task",
"with",
"the",
"given",
"name",
"and",
"version",
".",
"Initialization",
"that",
"bypasses",
"the",
"yield",
"self",
"and",
"define",
"step",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/packagetask.rb#L85-L96 | train |
maintux/esx | lib/esx.rb | ESX.Host.create_vm | def create_vm(specification)
spec = specification
spec[:cpus] = (specification[:cpus] || 1).to_i
spec[:cpu_cores] = (specification[:cpu_cores] || 1).to_i
spec[:guest_id] = specification[:guest_id] || 'otherGuest'
spec[:hw_version] = (specification[:hw_version] || 8).to_i
if specificatio... | ruby | def create_vm(specification)
spec = specification
spec[:cpus] = (specification[:cpus] || 1).to_i
spec[:cpu_cores] = (specification[:cpu_cores] || 1).to_i
spec[:guest_id] = specification[:guest_id] || 'otherGuest'
spec[:hw_version] = (specification[:hw_version] || 8).to_i
if specificatio... | [
"def",
"create_vm",
"(",
"specification",
")",
"spec",
"=",
"specification",
"spec",
"[",
":cpus",
"]",
"=",
"(",
"specification",
"[",
":cpus",
"]",
"||",
"1",
")",
".",
"to_i",
"spec",
"[",
":cpu_cores",
"]",
"=",
"(",
"specification",
"[",
":cpu_cores... | Create a Virtual Machine
Requires a Hash with the following keys:
{
:vm_name => name, (string, required)
:cpus => 1, #(int, optional)
:guest_id => 'otherGuest', #(string, optional)
:disk_size => 4096, #(in MB, optional)
:memory => 128, #(in MB, optional)
:datastore => datastore1 #(string, optiona... | [
"Create",
"a",
"Virtual",
"Machine"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L126-L207 | train |
maintux/esx | lib/esx.rb | ESX.Host.host_info | def host_info
[
@_host.summary.config.product.fullName,
@_host.summary.config.product.apiType,
@_host.summary.config.product.apiVersion,
@_host.summary.config.product.osType,
@_host.summary.config.product.productLineId,
@_host.summary.config.product.vendor,
@_host.... | ruby | def host_info
[
@_host.summary.config.product.fullName,
@_host.summary.config.product.apiType,
@_host.summary.config.product.apiVersion,
@_host.summary.config.product.osType,
@_host.summary.config.product.productLineId,
@_host.summary.config.product.vendor,
@_host.... | [
"def",
"host_info",
"[",
"@_host",
".",
"summary",
".",
"config",
".",
"product",
".",
"fullName",
",",
"@_host",
".",
"summary",
".",
"config",
".",
"product",
".",
"apiType",
",",
"@_host",
".",
"summary",
".",
"config",
".",
"product",
".",
"apiVersio... | Return product info as an array of strings containing
fullName, apiType, apiVersion, osType, productLineId, vendor, version | [
"Return",
"product",
"info",
"as",
"an",
"array",
"of",
"strings",
"containing"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L234-L244 | train |
maintux/esx | lib/esx.rb | ESX.Host.remote_command | def remote_command(cmd)
output = ""
Net::SSH.start(@address, @user, :password => @password) do |ssh|
output = ssh.exec! cmd
end
output
end | ruby | def remote_command(cmd)
output = ""
Net::SSH.start(@address, @user, :password => @password) do |ssh|
output = ssh.exec! cmd
end
output
end | [
"def",
"remote_command",
"(",
"cmd",
")",
"output",
"=",
"\"\"",
"Net",
"::",
"SSH",
".",
"start",
"(",
"@address",
",",
"@user",
",",
":password",
"=>",
"@password",
")",
"do",
"|",
"ssh",
"|",
"output",
"=",
"ssh",
".",
"exec!",
"cmd",
"end",
"outp... | Run a command in the ESX host via SSH | [
"Run",
"a",
"command",
"in",
"the",
"ESX",
"host",
"via",
"SSH"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L272-L278 | train |
maintux/esx | lib/esx.rb | ESX.Host.copy_from_template | def copy_from_template(template_disk, destination)
Log.debug "Copying from template #{template_disk} to #{destination}"
raise "Template does not exist" if not template_exist?(template_disk)
source = File.join(@templates_dir, File.basename(template_disk))
Net::SSH.start(@address, @user, :password... | ruby | def copy_from_template(template_disk, destination)
Log.debug "Copying from template #{template_disk} to #{destination}"
raise "Template does not exist" if not template_exist?(template_disk)
source = File.join(@templates_dir, File.basename(template_disk))
Net::SSH.start(@address, @user, :password... | [
"def",
"copy_from_template",
"(",
"template_disk",
",",
"destination",
")",
"Log",
".",
"debug",
"\"Copying from template #{template_disk} to #{destination}\"",
"raise",
"\"Template does not exist\"",
"if",
"not",
"template_exist?",
"(",
"template_disk",
")",
"source",
"=",
... | Expects vmdk source file path and destination path
copy_from_template "/home/fooser/my.vmdk", "/vmfs/volumes/datastore1/foovm/foovm.vmdk"
Destination directory must exist otherwise rises exception | [
"Expects",
"vmdk",
"source",
"file",
"path",
"and",
"destination",
"path"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L356-L364 | train |
maintux/esx | lib/esx.rb | ESX.Host.import_disk | def import_disk(source, destination, print_progress = false, params = {})
use_template = params[:use_template] || false
if use_template
Log.debug "import_disk :use_template => true"
if !template_exist?(source)
Log.debug "import_disk, template does not exist, importing."
i... | ruby | def import_disk(source, destination, print_progress = false, params = {})
use_template = params[:use_template] || false
if use_template
Log.debug "import_disk :use_template => true"
if !template_exist?(source)
Log.debug "import_disk, template does not exist, importing."
i... | [
"def",
"import_disk",
"(",
"source",
",",
"destination",
",",
"print_progress",
"=",
"false",
",",
"params",
"=",
"{",
"}",
")",
"use_template",
"=",
"params",
"[",
":use_template",
"]",
"||",
"false",
"if",
"use_template",
"Log",
".",
"debug",
"\"import_dis... | Imports a VMDK
if params has :use_template => true, the disk is saved as a template in
@templates_dir and cloned from there.
Destination directory must exist otherwise rises exception | [
"Imports",
"a",
"VMDK"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L374-L386 | train |
maintux/esx | lib/esx.rb | ESX.Host.import_disk_convert | def import_disk_convert(source, destination, print_progress = false)
tmp_dest = destination + ".tmp"
Net::SSH.start(@address, @user, :password => @password) do |ssh|
if not (ssh.exec! "ls #{destination} 2>/dev/null").nil?
raise Exception.new("Destination file #{destination} already exists"... | ruby | def import_disk_convert(source, destination, print_progress = false)
tmp_dest = destination + ".tmp"
Net::SSH.start(@address, @user, :password => @password) do |ssh|
if not (ssh.exec! "ls #{destination} 2>/dev/null").nil?
raise Exception.new("Destination file #{destination} already exists"... | [
"def",
"import_disk_convert",
"(",
"source",
",",
"destination",
",",
"print_progress",
"=",
"false",
")",
"tmp_dest",
"=",
"destination",
"+",
"\".tmp\"",
"Net",
"::",
"SSH",
".",
"start",
"(",
"@address",
",",
"@user",
",",
":password",
"=>",
"@password",
... | This method does all the heavy lifting when importing the disk.
It also converts the imported VMDK to thin format | [
"This",
"method",
"does",
"all",
"the",
"heavy",
"lifting",
"when",
"importing",
"the",
"disk",
".",
"It",
"also",
"converts",
"the",
"imported",
"VMDK",
"to",
"thin",
"format"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L392-L411 | train |
maintux/esx | lib/esx.rb | ESX.Host.create_disk_spec | def create_disk_spec(params)
disk_type = params[:disk_type] || :flat
disk_file = params[:disk_file]
if disk_type == :sparse and disk_file.nil?
raise Exception.new("Creating sparse disks in ESX is not supported. Use an existing image.")
end
disk_size = params[:disk_size]
datas... | ruby | def create_disk_spec(params)
disk_type = params[:disk_type] || :flat
disk_file = params[:disk_file]
if disk_type == :sparse and disk_file.nil?
raise Exception.new("Creating sparse disks in ESX is not supported. Use an existing image.")
end
disk_size = params[:disk_size]
datas... | [
"def",
"create_disk_spec",
"(",
"params",
")",
"disk_type",
"=",
"params",
"[",
":disk_type",
"]",
"||",
":flat",
"disk_file",
"=",
"params",
"[",
":disk_file",
"]",
"if",
"disk_type",
"==",
":sparse",
"and",
"disk_file",
".",
"nil?",
"raise",
"Exception",
"... | disk_file
datastore
disk_size
disk_type | [
"disk_file",
"datastore",
"disk_size",
"disk_type"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L424-L461 | train |
maintux/esx | lib/esx.rb | ESX.VM.destroy | def destroy
#disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
unless host.free_license
vm_object.Destroy_Task.wait_for_completion
else
host.remote_command "vim-cmd vmsvc/power.off #{vmid}"
host.remote_command "vim-cmd vmsvc/destroy #{vmid}"
end
... | ruby | def destroy
#disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
unless host.free_license
vm_object.Destroy_Task.wait_for_completion
else
host.remote_command "vim-cmd vmsvc/power.off #{vmid}"
host.remote_command "vim-cmd vmsvc/destroy #{vmid}"
end
... | [
"def",
"destroy",
"unless",
"host",
".",
"free_license",
"vm_object",
".",
"Destroy_Task",
".",
"wait_for_completion",
"else",
"host",
".",
"remote_command",
"\"vim-cmd vmsvc/power.off #{vmid}\"",
"host",
".",
"remote_command",
"\"vim-cmd vmsvc/destroy #{vmid}\"",
"end",
"e... | Destroy the VirtualMaching removing it from the inventory
and deleting the disk files | [
"Destroy",
"the",
"VirtualMaching",
"removing",
"it",
"from",
"the",
"inventory",
"and",
"deleting",
"the",
"disk",
"files"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L524-L532 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb | RI.AttributeFormatter.write_attribute_text | def write_attribute_text(prefix, line)
print prefix
line.each do |achar|
print achar.char
end
puts
end | ruby | def write_attribute_text(prefix, line)
print prefix
line.each do |achar|
print achar.char
end
puts
end | [
"def",
"write_attribute_text",
"(",
"prefix",
",",
"line",
")",
"print",
"prefix",
"line",
".",
"each",
"do",
"|",
"achar",
"|",
"print",
"achar",
".",
"char",
"end",
"puts",
"end"
] | overridden in specific formatters | [
"overridden",
"in",
"specific",
"formatters"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb#L331-L337 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb | RI.OverstrikeFormatter.bold_print | def bold_print(text)
text.split(//).each do |ch|
print ch, BS, ch
end
end | ruby | def bold_print(text)
text.split(//).each do |ch|
print ch, BS, ch
end
end | [
"def",
"bold_print",
"(",
"text",
")",
"text",
".",
"split",
"(",
"/",
"/",
")",
".",
"each",
"do",
"|",
"ch",
"|",
"print",
"ch",
",",
"BS",
",",
"ch",
"end",
"end"
] | draw a string in bold | [
"draw",
"a",
"string",
"in",
"bold"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb#L390-L394 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb | RI.SimpleFormatter.display_heading | def display_heading(text, level, indent)
text = strip_attributes(text)
case level
when 1
puts "= " + text.upcase
when 2
puts "-- " + text
else
print indent, text, "\n"
end
end | ruby | def display_heading(text, level, indent)
text = strip_attributes(text)
case level
when 1
puts "= " + text.upcase
when 2
puts "-- " + text
else
print indent, text, "\n"
end
end | [
"def",
"display_heading",
"(",
"text",
",",
"level",
",",
"indent",
")",
"text",
"=",
"strip_attributes",
"(",
"text",
")",
"case",
"level",
"when",
"1",
"puts",
"\"= \"",
"+",
"text",
".",
"upcase",
"when",
"2",
"puts",
"\"-- \"",
"+",
"text",
"else",
... | Place heading level indicators inline with heading. | [
"Place",
"heading",
"level",
"indicators",
"inline",
"with",
"heading",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb#L633-L643 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb | Rack.Request.POST | def POST
if @env["rack.request.form_input"].eql? @env["rack.input"]
@env["rack.request.form_hash"]
elsif form_data? || parseable_data?
@env["rack.request.form_input"] = @env["rack.input"]
unless @env["rack.request.form_hash"] =
Utils::Multipart.parse_multipart(env)
... | ruby | def POST
if @env["rack.request.form_input"].eql? @env["rack.input"]
@env["rack.request.form_hash"]
elsif form_data? || parseable_data?
@env["rack.request.form_input"] = @env["rack.input"]
unless @env["rack.request.form_hash"] =
Utils::Multipart.parse_multipart(env)
... | [
"def",
"POST",
"if",
"@env",
"[",
"\"rack.request.form_input\"",
"]",
".",
"eql?",
"@env",
"[",
"\"rack.input\"",
"]",
"@env",
"[",
"\"rack.request.form_hash\"",
"]",
"elsif",
"form_data?",
"||",
"parseable_data?",
"@env",
"[",
"\"rack.request.form_input\"",
"]",
"=... | Returns the data recieved in the request body.
This method support both application/x-www-form-urlencoded and
multipart/form-data. | [
"Returns",
"the",
"data",
"recieved",
"in",
"the",
"request",
"body",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb#L127-L148 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb | Rack.Request.url | def url
url = scheme + "://"
url << host
if scheme == "https" && port != 443 ||
scheme == "http" && port != 80
url << ":#{port}"
end
url << fullpath
url
end | ruby | def url
url = scheme + "://"
url << host
if scheme == "https" && port != 443 ||
scheme == "http" && port != 80
url << ":#{port}"
end
url << fullpath
url
end | [
"def",
"url",
"url",
"=",
"scheme",
"+",
"\"://\"",
"url",
"<<",
"host",
"if",
"scheme",
"==",
"\"https\"",
"&&",
"port",
"!=",
"443",
"||",
"scheme",
"==",
"\"http\"",
"&&",
"port",
"!=",
"80",
"url",
"<<",
"\":#{port}\"",
"end",
"url",
"<<",
"fullpat... | Tries to return a remake of the original request URL as a string. | [
"Tries",
"to",
"return",
"a",
"remake",
"of",
"the",
"original",
"request",
"URL",
"as",
"a",
"string",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb#L204-L216 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbProtocol.open | def open(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open(uri, config)
rescue DRbBadScheme
rescue DRbConnError
raise($!)
rescue
raise(DRbConnError, "#{uri} - #{$!.inspect}")
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open(ur... | ruby | def open(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open(uri, config)
rescue DRbBadScheme
rescue DRbConnError
raise($!)
rescue
raise(DRbConnError, "#{uri} - #{$!.inspect}")
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open(ur... | [
"def",
"open",
"(",
"uri",
",",
"config",
",",
"first",
"=",
"true",
")",
"@protocol",
".",
"each",
"do",
"|",
"prot",
"|",
"begin",
"return",
"prot",
".",
"open",
"(",
"uri",
",",
"config",
")",
"rescue",
"DRbBadScheme",
"rescue",
"DRbConnError",
"rai... | Open a client connection to +uri+ with the configuration +config+.
The DRbProtocol module asks each registered protocol in turn to
try to open the URI. Each protocol signals that it does not handle that
URI by raising a DRbBadScheme error. If no protocol recognises the
URI, then a DRbBadURI error is raised. If ... | [
"Open",
"a",
"client",
"connection",
"to",
"+",
"uri",
"+",
"with",
"the",
"configuration",
"+",
"config",
"+",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L758-L774 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbProtocol.open_server | def open_server(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open_server(uri, config)
rescue DRbBadScheme
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open_server(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' ... | ruby | def open_server(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open_server(uri, config)
rescue DRbBadScheme
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open_server(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' ... | [
"def",
"open_server",
"(",
"uri",
",",
"config",
",",
"first",
"=",
"true",
")",
"@protocol",
".",
"each",
"do",
"|",
"prot",
"|",
"begin",
"return",
"prot",
".",
"open_server",
"(",
"uri",
",",
"config",
")",
"rescue",
"DRbBadScheme",
"end",
"end",
"i... | Open a server listening for connections at +uri+ with
configuration +config+.
The DRbProtocol module asks each registered protocol in turn to
try to open a server at the URI. Each protocol signals that it does
not handle that URI by raising a DRbBadScheme error. If no protocol
recognises the URI, then a DRbBadU... | [
"Open",
"a",
"server",
"listening",
"for",
"connections",
"at",
"+",
"uri",
"+",
"with",
"configuration",
"+",
"config",
"+",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L786-L798 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbTCPSocket.send_request | def send_request(ref, msg_id, arg, b)
@msg.send_request(stream, ref, msg_id, arg, b)
end | ruby | def send_request(ref, msg_id, arg, b)
@msg.send_request(stream, ref, msg_id, arg, b)
end | [
"def",
"send_request",
"(",
"ref",
",",
"msg_id",
",",
"arg",
",",
"b",
")",
"@msg",
".",
"send_request",
"(",
"stream",
",",
"ref",
",",
"msg_id",
",",
"arg",
",",
"b",
")",
"end"
] | On the client side, send a request to the server. | [
"On",
"the",
"client",
"side",
"send",
"a",
"request",
"to",
"the",
"server",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L937-L939 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbObject.method_missing | def method_missing(msg_id, *a, &b)
if DRb.here?(@uri)
obj = DRb.to_obj(@ref)
DRb.current_server.check_insecure_method(obj, msg_id)
return obj.__send__(msg_id, *a, &b)
end
succ, result = self.class.with_friend(@uri) do
DRbConn.open(@uri) do |conn|
conn.send_message(self, msg_id, ... | ruby | def method_missing(msg_id, *a, &b)
if DRb.here?(@uri)
obj = DRb.to_obj(@ref)
DRb.current_server.check_insecure_method(obj, msg_id)
return obj.__send__(msg_id, *a, &b)
end
succ, result = self.class.with_friend(@uri) do
DRbConn.open(@uri) do |conn|
conn.send_message(self, msg_id, ... | [
"def",
"method_missing",
"(",
"msg_id",
",",
"*",
"a",
",",
"&",
"b",
")",
"if",
"DRb",
".",
"here?",
"(",
"@uri",
")",
"obj",
"=",
"DRb",
".",
"to_obj",
"(",
"@ref",
")",
"DRb",
".",
"current_server",
".",
"check_insecure_method",
"(",
"obj",
",",
... | Routes method calls to the referenced object. | [
"Routes",
"method",
"calls",
"to",
"the",
"referenced",
"object",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1114-L1136 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.stop_service | def stop_service
DRb.remove_server(self)
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
Thread.current['DRb']['stop_service'] = true
else
@thread.kill
end
end | ruby | def stop_service
DRb.remove_server(self)
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
Thread.current['DRb']['stop_service'] = true
else
@thread.kill
end
end | [
"def",
"stop_service",
"DRb",
".",
"remove_server",
"(",
"self",
")",
"if",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",
"&&",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",
"[",
"'server'",
"]",
"==",
"self",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",... | Stop this server. | [
"Stop",
"this",
"server",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1427-L1434 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.to_obj | def to_obj(ref)
return front if ref.nil?
return front[ref.to_s] if DRbURIOption === ref
@idconv.to_obj(ref)
end | ruby | def to_obj(ref)
return front if ref.nil?
return front[ref.to_s] if DRbURIOption === ref
@idconv.to_obj(ref)
end | [
"def",
"to_obj",
"(",
"ref",
")",
"return",
"front",
"if",
"ref",
".",
"nil?",
"return",
"front",
"[",
"ref",
".",
"to_s",
"]",
"if",
"DRbURIOption",
"===",
"ref",
"@idconv",
".",
"to_obj",
"(",
"ref",
")",
"end"
] | Convert a dRuby reference to the local object it refers to. | [
"Convert",
"a",
"dRuby",
"reference",
"to",
"the",
"local",
"object",
"it",
"refers",
"to",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1437-L1441 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.check_insecure_method | def check_insecure_method(obj, msg_id)
return true if Proc === obj && msg_id == :__drb_yield
raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class
raise(SecurityError, "insecure method `#{msg_id}'") if insecure_method?(msg_id)
if obj.private_methods.inc... | ruby | def check_insecure_method(obj, msg_id)
return true if Proc === obj && msg_id == :__drb_yield
raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class
raise(SecurityError, "insecure method `#{msg_id}'") if insecure_method?(msg_id)
if obj.private_methods.inc... | [
"def",
"check_insecure_method",
"(",
"obj",
",",
"msg_id",
")",
"return",
"true",
"if",
"Proc",
"===",
"obj",
"&&",
"msg_id",
"==",
":__drb_yield",
"raise",
"(",
"ArgumentError",
",",
"\"#{any_to_s(msg_id)} is not a symbol\"",
")",
"unless",
"Symbol",
"==",
"msg_i... | Check that a method is callable via dRuby.
+obj+ is the object we want to invoke the method on. +msg_id+ is the
method name, as a Symbol.
If the method is an insecure method (see #insecure_method?) a
SecurityError is thrown. If the method is private or undefined,
a NameError is thrown. | [
"Check",
"that",
"a",
"method",
"is",
"callable",
"via",
"dRuby",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1505-L1519 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.main_loop | def main_loop
Thread.start(@protocol.accept) do |client|
@grp.add Thread.current
Thread.current['DRb'] = { 'client' => client ,
'server' => self }
loop do
begin
succ = false
invoke_method = InvokeMethod.new(self, client)
succ, result = invoke_method.perform
if ... | ruby | def main_loop
Thread.start(@protocol.accept) do |client|
@grp.add Thread.current
Thread.current['DRb'] = { 'client' => client ,
'server' => self }
loop do
begin
succ = false
invoke_method = InvokeMethod.new(self, client)
succ, result = invoke_method.perform
if ... | [
"def",
"main_loop",
"Thread",
".",
"start",
"(",
"@protocol",
".",
"accept",
")",
"do",
"|",
"client",
"|",
"@grp",
".",
"add",
"Thread",
".",
"current",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",
"=",
"{",
"'client'",
"=>",
"client",
",",
"'server'"... | The main loop performed by a DRbServer's internal thread.
Accepts a connection from a client, and starts up its own
thread to handle it. This thread loops, receiving requests
from the client, invoking them on a local object, and
returning responses, until the client closes the connection
or a local method call f... | [
"The",
"main",
"loop",
"performed",
"by",
"a",
"DRbServer",
"s",
"internal",
"thread",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1618-L1644 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_postgre.rb | ::JdbcSpec.PostgreSQL.supports_standard_conforming_strings? | def supports_standard_conforming_strings?
# Temporarily set the client message level above error to prevent unintentional
# error messages in the logs when working on a PostgreSQL database server that
# does not support standard conforming strings.
client_min_messages_old = client_min_messages
... | ruby | def supports_standard_conforming_strings?
# Temporarily set the client message level above error to prevent unintentional
# error messages in the logs when working on a PostgreSQL database server that
# does not support standard conforming strings.
client_min_messages_old = client_min_messages
... | [
"def",
"supports_standard_conforming_strings?",
"client_min_messages_old",
"=",
"client_min_messages",
"self",
".",
"client_min_messages",
"=",
"'panic'",
"has_support",
"=",
"select",
"(",
"'SHOW standard_conforming_strings'",
")",
".",
"to_a",
"[",
"0",
"]",
"[",
"0",
... | Does PostgreSQL support standard conforming strings? | [
"Does",
"PostgreSQL",
"support",
"standard",
"conforming",
"strings?"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_postgre.rb#L120-L133 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rdoctask.rb | Rake.RDocTask.define | def define
if rdoc_task_name != "rdoc"
desc "Build the RDOC HTML Files"
else
desc "Build the #{rdoc_task_name} HTML Files"
end
task rdoc_task_name
desc "Force a rebuild of the RDOC files"
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
... | ruby | def define
if rdoc_task_name != "rdoc"
desc "Build the RDOC HTML Files"
else
desc "Build the #{rdoc_task_name} HTML Files"
end
task rdoc_task_name
desc "Force a rebuild of the RDOC files"
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
... | [
"def",
"define",
"if",
"rdoc_task_name",
"!=",
"\"rdoc\"",
"desc",
"\"Build the RDOC HTML Files\"",
"else",
"desc",
"\"Build the #{rdoc_task_name} HTML Files\"",
"end",
"task",
"rdoc_task_name",
"desc",
"\"Force a rebuild of the RDOC files\"",
"task",
"rerdoc_task_name",
"=>",
... | Create an RDoc task with the given name. See the RDocTask class overview
for documentation.
Create the tasks defined by this task lib. | [
"Create",
"an",
"RDoc",
"task",
"with",
"the",
"given",
"name",
".",
"See",
"the",
"RDocTask",
"class",
"overview",
"for",
"documentation",
".",
"Create",
"the",
"tasks",
"defined",
"by",
"this",
"task",
"lib",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rdoctask.rb#L111-L144 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/runit/assert.rb | RUNIT.Assert.assert_match | def assert_match(actual_string, expected_re, message="")
_wrap_assertion {
full_message = build_message(message, "Expected <?> to match <?>", actual_string, expected_re)
assert_block(full_message) {
expected_re =~ actual_string
}
Regexp.last_match
}
end | ruby | def assert_match(actual_string, expected_re, message="")
_wrap_assertion {
full_message = build_message(message, "Expected <?> to match <?>", actual_string, expected_re)
assert_block(full_message) {
expected_re =~ actual_string
}
Regexp.last_match
}
end | [
"def",
"assert_match",
"(",
"actual_string",
",",
"expected_re",
",",
"message",
"=",
"\"\"",
")",
"_wrap_assertion",
"{",
"full_message",
"=",
"build_message",
"(",
"message",
",",
"\"Expected <?> to match <?>\"",
",",
"actual_string",
",",
"expected_re",
")",
"ass... | To deal with the fact that RubyUnit does not check that the
regular expression is, indeed, a regular expression, if it is
not, we do our own assertion using the same semantics as
RubyUnit | [
"To",
"deal",
"with",
"the",
"fact",
"that",
"RubyUnit",
"does",
"not",
"check",
"that",
"the",
"regular",
"expression",
"is",
"indeed",
"a",
"regular",
"expression",
"if",
"it",
"is",
"not",
"we",
"do",
"our",
"own",
"assertion",
"using",
"the",
"same",
... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/runit/assert.rb#L23-L31 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/gempackagetask.rb | Rake.GemPackageTask.init | def init(gem)
super(gem.name, gem.version)
@gem_spec = gem
@package_files += gem_spec.files if gem_spec.files
end | ruby | def init(gem)
super(gem.name, gem.version)
@gem_spec = gem
@package_files += gem_spec.files if gem_spec.files
end | [
"def",
"init",
"(",
"gem",
")",
"super",
"(",
"gem",
".",
"name",
",",
"gem",
".",
"version",
")",
"@gem_spec",
"=",
"gem",
"@package_files",
"+=",
"gem_spec",
".",
"files",
"if",
"gem_spec",
".",
"files",
"end"
] | Create a GEM Package task library. Automatically define the gem
if a block is given. If no block is supplied, then +define+
needs to be called to define the task.
Initialization tasks without the "yield self" or define
operations. | [
"Create",
"a",
"GEM",
"Package",
"task",
"library",
".",
"Automatically",
"define",
"the",
"gem",
"if",
"a",
"block",
"is",
"given",
".",
"If",
"no",
"block",
"is",
"supplied",
"then",
"+",
"define",
"+",
"needs",
"to",
"be",
"called",
"to",
"define",
... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/gempackagetask.rb#L64-L68 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/xml_mini/rexml.rb | ActiveSupport.XmlMini_REXML.parse | def parse(string)
require 'rexml/document' unless defined?(REXML::Document)
doc = REXML::Document.new(string)
merge_element!({}, doc.root)
end | ruby | def parse(string)
require 'rexml/document' unless defined?(REXML::Document)
doc = REXML::Document.new(string)
merge_element!({}, doc.root)
end | [
"def",
"parse",
"(",
"string",
")",
"require",
"'rexml/document'",
"unless",
"defined?",
"(",
"REXML",
"::",
"Document",
")",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"(",
"string",
")",
"merge_element!",
"(",
"{",
"}",
",",
"doc",
".",
"root",... | Parse an XML Document string into a simple hash
Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
and uses the defaults from ActiveSupport
string::
XML Document string to parse | [
"Parse",
"an",
"XML",
"Document",
"string",
"into",
"a",
"simple",
"hash"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/xml_mini/rexml.rb#L15-L19 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb | SM.ToHtml.init_tags | def init_tags
@attr_tags = [
InlineTag.new(SM::Attribute.bitmap_for(:BOLD), "<b>", "</b>"),
InlineTag.new(SM::Attribute.bitmap_for(:TT), "<tt>", "</tt>"),
InlineTag.new(SM::Attribute.bitmap_for(:EM), "<em>", "</em>"),
]
end | ruby | def init_tags
@attr_tags = [
InlineTag.new(SM::Attribute.bitmap_for(:BOLD), "<b>", "</b>"),
InlineTag.new(SM::Attribute.bitmap_for(:TT), "<tt>", "</tt>"),
InlineTag.new(SM::Attribute.bitmap_for(:EM), "<em>", "</em>"),
]
end | [
"def",
"init_tags",
"@attr_tags",
"=",
"[",
"InlineTag",
".",
"new",
"(",
"SM",
"::",
"Attribute",
".",
"bitmap_for",
"(",
":BOLD",
")",
",",
"\"<b>\"",
",",
"\"</b>\"",
")",
",",
"InlineTag",
".",
"new",
"(",
"SM",
"::",
"Attribute",
".",
"bitmap_for",
... | Set up the standard mapping of attributes to HTML tags | [
"Set",
"up",
"the",
"standard",
"mapping",
"of",
"attributes",
"to",
"HTML",
"tags"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb#L28-L34 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb | SM.ToHtml.add_tag | def add_tag(name, start, stop)
@attr_tags << InlineTag.new(SM::Attribute.bitmap_for(name), start, stop)
end | ruby | def add_tag(name, start, stop)
@attr_tags << InlineTag.new(SM::Attribute.bitmap_for(name), start, stop)
end | [
"def",
"add_tag",
"(",
"name",
",",
"start",
",",
"stop",
")",
"@attr_tags",
"<<",
"InlineTag",
".",
"new",
"(",
"SM",
"::",
"Attribute",
".",
"bitmap_for",
"(",
"name",
")",
",",
"start",
",",
"stop",
")",
"end"
] | Add a new set of HTML tags for an attribute. We allow
separate start and end tags for flexibility | [
"Add",
"a",
"new",
"set",
"of",
"HTML",
"tags",
"for",
"an",
"attribute",
".",
"We",
"allow",
"separate",
"start",
"and",
"end",
"tags",
"for",
"flexibility"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb#L40-L42 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/net/http.rb | Net.HTTPHeader.set_form_data | def set_form_data(params, sep = '&')
self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end | ruby | def set_form_data(params, sep = '&')
self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end | [
"def",
"set_form_data",
"(",
"params",
",",
"sep",
"=",
"'&'",
")",
"self",
".",
"body",
"=",
"params",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"\"#{urlencode(k.to_s)}=#{urlencode(v.to_s)}\"",
"}",
".",
"join",
"(",
"sep",
")",
"self",
".",
"content_ty... | Set header fields and a body from HTML form data.
+params+ should be a Hash containing HTML form data.
Optional argument +sep+ means data record separator.
This method also set Content-Type: header field to
application/x-www-form-urlencoded. | [
"Set",
"header",
"fields",
"and",
"a",
"body",
"from",
"HTML",
"form",
"data",
".",
"+",
"params",
"+",
"should",
"be",
"a",
"Hash",
"containing",
"HTML",
"form",
"data",
".",
"Optional",
"argument",
"+",
"sep",
"+",
"means",
"data",
"record",
"separator... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/net/http.rb#L1432-L1435 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb | Rinda.Tuple.each | def each # FIXME
if Hash === @tuple
@tuple.each { |k, v| yield(k, v) }
else
@tuple.each_with_index { |v, k| yield(k, v) }
end
end | ruby | def each # FIXME
if Hash === @tuple
@tuple.each { |k, v| yield(k, v) }
else
@tuple.each_with_index { |v, k| yield(k, v) }
end
end | [
"def",
"each",
"if",
"Hash",
"===",
"@tuple",
"@tuple",
".",
"each",
"{",
"|",
"k",
",",
"v",
"|",
"yield",
"(",
"k",
",",
"v",
")",
"}",
"else",
"@tuple",
".",
"each_with_index",
"{",
"|",
"v",
",",
"k",
"|",
"yield",
"(",
"k",
",",
"v",
")"... | Iterate through the tuple, yielding the index or key, and the
value, thus ensuring arrays are iterated similarly to hashes. | [
"Iterate",
"through",
"the",
"tuple",
"yielding",
"the",
"index",
"or",
"key",
"and",
"the",
"value",
"thus",
"ensuring",
"arrays",
"are",
"iterated",
"similarly",
"to",
"hashes",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb#L84-L90 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb | Rinda.Tuple.init_with_ary | def init_with_ary(ary)
@tuple = Array.new(ary.size)
@tuple.size.times do |i|
@tuple[i] = ary[i]
end
end | ruby | def init_with_ary(ary)
@tuple = Array.new(ary.size)
@tuple.size.times do |i|
@tuple[i] = ary[i]
end
end | [
"def",
"init_with_ary",
"(",
"ary",
")",
"@tuple",
"=",
"Array",
".",
"new",
"(",
"ary",
".",
"size",
")",
"@tuple",
".",
"size",
".",
"times",
"do",
"|",
"i",
"|",
"@tuple",
"[",
"i",
"]",
"=",
"ary",
"[",
"i",
"]",
"end",
"end"
] | Munges +ary+ into a valid Tuple. | [
"Munges",
"+",
"ary",
"+",
"into",
"a",
"valid",
"Tuple",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb#L107-L112 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb | Rinda.Tuple.init_with_hash | def init_with_hash(hash)
@tuple = Hash.new
hash.each do |k, v|
raise InvalidHashTupleKey unless String === k
@tuple[k] = v
end
end | ruby | def init_with_hash(hash)
@tuple = Hash.new
hash.each do |k, v|
raise InvalidHashTupleKey unless String === k
@tuple[k] = v
end
end | [
"def",
"init_with_hash",
"(",
"hash",
")",
"@tuple",
"=",
"Hash",
".",
"new",
"hash",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"raise",
"InvalidHashTupleKey",
"unless",
"String",
"===",
"k",
"@tuple",
"[",
"k",
"]",
"=",
"v",
"end",
"end"
] | Ensures +hash+ is a valid Tuple. | [
"Ensures",
"+",
"hash",
"+",
"is",
"a",
"valid",
"Tuple",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb#L117-L123 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb | XSD.XSDFloat.narrow32bit | def narrow32bit(f)
if f.nan? || f.infinite?
f
elsif f.abs < MIN_POSITIVE_SINGLE
XSDFloat.positive?(f) ? POSITIVE_ZERO : NEGATIVE_ZERO
else
f
end
end | ruby | def narrow32bit(f)
if f.nan? || f.infinite?
f
elsif f.abs < MIN_POSITIVE_SINGLE
XSDFloat.positive?(f) ? POSITIVE_ZERO : NEGATIVE_ZERO
else
f
end
end | [
"def",
"narrow32bit",
"(",
"f",
")",
"if",
"f",
".",
"nan?",
"||",
"f",
".",
"infinite?",
"f",
"elsif",
"f",
".",
"abs",
"<",
"MIN_POSITIVE_SINGLE",
"XSDFloat",
".",
"positive?",
"(",
"f",
")",
"?",
"POSITIVE_ZERO",
":",
"NEGATIVE_ZERO",
"else",
"f",
"... | Convert to single-precision 32-bit floating point value. | [
"Convert",
"to",
"single",
"-",
"precision",
"32",
"-",
"bit",
"floating",
"point",
"value",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb#L352-L360 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb | XSD.XSDHexBinary.set_encoded | def set_encoded(value)
if /^[0-9a-fA-F]*$/ !~ value
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
end
@data = String.new(value).strip
@is_nil = false
end | ruby | def set_encoded(value)
if /^[0-9a-fA-F]*$/ !~ value
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
end
@data = String.new(value).strip
@is_nil = false
end | [
"def",
"set_encoded",
"(",
"value",
")",
"if",
"/",
"/",
"!~",
"value",
"raise",
"ValueSpaceError",
".",
"new",
"(",
"\"#{ type }: cannot accept '#{ value }'.\"",
")",
"end",
"@data",
"=",
"String",
".",
"new",
"(",
"value",
")",
".",
"strip",
"@is_nil",
"="... | String in Ruby could be a binary. | [
"String",
"in",
"Ruby",
"could",
"be",
"a",
"binary",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb#L880-L886 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/rescuable.rb | ActiveSupport.Rescuable.rescue_with_handler | def rescue_with_handler(exception)
if handler = handler_for_rescue(exception)
handler.arity != 0 ? handler.call(exception) : handler.call
true # don't rely on the return value of the handler
end
end | ruby | def rescue_with_handler(exception)
if handler = handler_for_rescue(exception)
handler.arity != 0 ? handler.call(exception) : handler.call
true # don't rely on the return value of the handler
end
end | [
"def",
"rescue_with_handler",
"(",
"exception",
")",
"if",
"handler",
"=",
"handler_for_rescue",
"(",
"exception",
")",
"handler",
".",
"arity",
"!=",
"0",
"?",
"handler",
".",
"call",
"(",
"exception",
")",
":",
"handler",
".",
"call",
"true",
"end",
"end... | Tries to rescue the exception by looking up and calling a registered handler. | [
"Tries",
"to",
"rescue",
"the",
"exception",
"by",
"looking",
"up",
"and",
"calling",
"a",
"registered",
"handler",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/rescuable.rb#L71-L76 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb | SM.PreProcess.handle | def handle(text)
text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do
prefix = $1
directive = $2.downcase
param = $3
case directive
when "include"
filename = param.split[0]
include_file(filename, prefix)
else
yield(directive, param)
... | ruby | def handle(text)
text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do
prefix = $1
directive = $2.downcase
param = $3
case directive
when "include"
filename = param.split[0]
include_file(filename, prefix)
else
yield(directive, param)
... | [
"def",
"handle",
"(",
"text",
")",
"text",
".",
"gsub!",
"(",
"/",
"\\t",
"\\w",
"\\s",
"\\n",
"/",
")",
"do",
"prefix",
"=",
"$1",
"directive",
"=",
"$2",
".",
"downcase",
"param",
"=",
"$3",
"case",
"directive",
"when",
"\"include\"",
"filename",
"... | Look for common options in a chunk of text. Options that
we don't handle are passed back to our caller
as |directive, param| | [
"Look",
"for",
"common",
"options",
"in",
"a",
"chunk",
"of",
"text",
".",
"Options",
"that",
"we",
"don",
"t",
"handle",
"are",
"passed",
"back",
"to",
"our",
"caller",
"as",
"|directive",
"param|"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb#L20-L35 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb | SM.PreProcess.include_file | def include_file(name, indent)
if (full_name = find_include_file(name))
content = File.open(full_name) {|f| f.read}
# strip leading '#'s, but only if all lines start with them
if content =~ /^[^#]/
content.gsub(/^/, indent)
else
content.gsub(/^#?/, indent)
... | ruby | def include_file(name, indent)
if (full_name = find_include_file(name))
content = File.open(full_name) {|f| f.read}
# strip leading '#'s, but only if all lines start with them
if content =~ /^[^#]/
content.gsub(/^/, indent)
else
content.gsub(/^#?/, indent)
... | [
"def",
"include_file",
"(",
"name",
",",
"indent",
")",
"if",
"(",
"full_name",
"=",
"find_include_file",
"(",
"name",
")",
")",
"content",
"=",
"File",
".",
"open",
"(",
"full_name",
")",
"{",
"|",
"f",
"|",
"f",
".",
"read",
"}",
"if",
"content",
... | Include a file, indenting it correctly | [
"Include",
"a",
"file",
"indenting",
"it",
"correctly"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb#L43-L56 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb | SM.PreProcess.find_include_file | def find_include_file(name)
to_search = [ File.dirname(@input_file_name) ].concat @include_path
to_search.each do |dir|
full_name = File.join(dir, name)
stat = File.stat(full_name) rescue next
return full_name if stat.readable?
end
nil
end | ruby | def find_include_file(name)
to_search = [ File.dirname(@input_file_name) ].concat @include_path
to_search.each do |dir|
full_name = File.join(dir, name)
stat = File.stat(full_name) rescue next
return full_name if stat.readable?
end
nil
end | [
"def",
"find_include_file",
"(",
"name",
")",
"to_search",
"=",
"[",
"File",
".",
"dirname",
"(",
"@input_file_name",
")",
"]",
".",
"concat",
"@include_path",
"to_search",
".",
"each",
"do",
"|",
"dir",
"|",
"full_name",
"=",
"File",
".",
"join",
"(",
"... | Look for the given file in the directory containing the current
file, and then in each of the directories specified in the
RDOC_INCLUDE path | [
"Look",
"for",
"the",
"given",
"file",
"in",
"the",
"directory",
"containing",
"the",
"current",
"file",
"and",
"then",
"in",
"each",
"of",
"the",
"directories",
"specified",
"in",
"the",
"RDOC_INCLUDE",
"path"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb#L62-L70 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.parse_subprogram | def parse_subprogram(subprogram, params, comment, code,
before_contains=nil, function=nil, prefix=nil)
subprogram.singleton = false
prefix = "" if !prefix
arguments = params.sub(/\(/, "").sub(/\)/, "").split(",") if params
args_comment, params_opt =
find_argume... | ruby | def parse_subprogram(subprogram, params, comment, code,
before_contains=nil, function=nil, prefix=nil)
subprogram.singleton = false
prefix = "" if !prefix
arguments = params.sub(/\(/, "").sub(/\)/, "").split(",") if params
args_comment, params_opt =
find_argume... | [
"def",
"parse_subprogram",
"(",
"subprogram",
",",
"params",
",",
"comment",
",",
"code",
",",
"before_contains",
"=",
"nil",
",",
"function",
"=",
"nil",
",",
"prefix",
"=",
"nil",
")",
"subprogram",
".",
"singleton",
"=",
"false",
"prefix",
"=",
"\"\"",
... | End of parse_program_or_module
Parse arguments, comment, code of subroutine and function.
Return AnyMethod object. | [
"End",
"of",
"parse_program_or_module"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1007-L1034 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.collect_first_comment | def collect_first_comment(body)
comment = ""
not_comment = ""
comment_start = false
comment_end = false
body.split("\n").each{ |line|
if comment_end
not_comment << line
not_comment << "\n"
elsif /^\s*?!\s?(.*)$/i =~ line
comment_start = true
... | ruby | def collect_first_comment(body)
comment = ""
not_comment = ""
comment_start = false
comment_end = false
body.split("\n").each{ |line|
if comment_end
not_comment << line
not_comment << "\n"
elsif /^\s*?!\s?(.*)$/i =~ line
comment_start = true
... | [
"def",
"collect_first_comment",
"(",
"body",
")",
"comment",
"=",
"\"\"",
"not_comment",
"=",
"\"\"",
"comment_start",
"=",
"false",
"comment_end",
"=",
"false",
"body",
".",
"split",
"(",
"\"\\n\"",
")",
".",
"each",
"{",
"|",
"line",
"|",
"if",
"comment_... | Collect comment for file entity | [
"Collect",
"comment",
"for",
"file",
"entity"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1039-L1061 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.find_namelists | def find_namelists(text, before_contains=nil)
return nil if !text
result = ""
lines = "#{text}"
before_contains = "" if !before_contains
while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i
lines = $~.post_match
nml_comment = COMMENTS_ARE_UPPER ?
fin... | ruby | def find_namelists(text, before_contains=nil)
return nil if !text
result = ""
lines = "#{text}"
before_contains = "" if !before_contains
while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i
lines = $~.post_match
nml_comment = COMMENTS_ARE_UPPER ?
fin... | [
"def",
"find_namelists",
"(",
"text",
",",
"before_contains",
"=",
"nil",
")",
"return",
"nil",
"if",
"!",
"text",
"result",
"=",
"\"\"",
"lines",
"=",
"\"#{text}\"",
"before_contains",
"=",
"\"\"",
"if",
"!",
"before_contains",
"while",
"lines",
"=~",
"/",
... | Return comments of definitions of namelists | [
"Return",
"comments",
"of",
"definitions",
"of",
"namelists"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1123-L1142 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.find_comments | def find_comments text
return "" unless text
lines = text.split("\n")
lines.reverse! if COMMENTS_ARE_UPPER
comment_block = Array.new
lines.each do |line|
break if line =~ /^\s*?\w/ || line =~ /^\s*?$/
if COMMENTS_ARE_UPPER
comment_block.unshift line.sub(/^\s*?!\s?... | ruby | def find_comments text
return "" unless text
lines = text.split("\n")
lines.reverse! if COMMENTS_ARE_UPPER
comment_block = Array.new
lines.each do |line|
break if line =~ /^\s*?\w/ || line =~ /^\s*?$/
if COMMENTS_ARE_UPPER
comment_block.unshift line.sub(/^\s*?!\s?... | [
"def",
"find_comments",
"text",
"return",
"\"\"",
"unless",
"text",
"lines",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
"lines",
".",
"reverse!",
"if",
"COMMENTS_ARE_UPPER",
"comment_block",
"=",
"Array",
".",
"new",
"lines",
".",
"each",
"do",
"|",
"... | Comments just after module or subprogram, or arguments are
returned. If "COMMENTS_ARE_UPPER" is true, comments just before
modules or subprograms are returned | [
"Comments",
"just",
"after",
"module",
"or",
"subprogram",
"or",
"arguments",
"are",
"returned",
".",
"If",
"COMMENTS_ARE_UPPER",
"is",
"true",
"comments",
"just",
"before",
"modules",
"or",
"subprograms",
"are",
"returned"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1149-L1165 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.initialize_public_method | def initialize_public_method(method, parent)
return if !method || !parent
new_meth = AnyMethod.new("External Alias for module", method.name)
new_meth.singleton = method.singleton
new_meth.params = method.params.clone
new_meth.comment = remove_trailing_alias(method.comment.cl... | ruby | def initialize_public_method(method, parent)
return if !method || !parent
new_meth = AnyMethod.new("External Alias for module", method.name)
new_meth.singleton = method.singleton
new_meth.params = method.params.clone
new_meth.comment = remove_trailing_alias(method.comment.cl... | [
"def",
"initialize_public_method",
"(",
"method",
",",
"parent",
")",
"return",
"if",
"!",
"method",
"||",
"!",
"parent",
"new_meth",
"=",
"AnyMethod",
".",
"new",
"(",
"\"External Alias for module\"",
",",
"method",
".",
"name",
")",
"new_meth",
".",
"singlet... | Create method for internal alias | [
"Create",
"method",
"for",
"internal",
"alias"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1177-L1187 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.initialize_external_method | def initialize_external_method(new, old, params, file, comment, token=nil,
internal=nil, nolink=nil)
return nil unless new || old
if internal
external_alias_header = "#{INTERNAL_ALIAS_MES} "
external_alias_text = external_alias_header + old
elsif ... | ruby | def initialize_external_method(new, old, params, file, comment, token=nil,
internal=nil, nolink=nil)
return nil unless new || old
if internal
external_alias_header = "#{INTERNAL_ALIAS_MES} "
external_alias_text = external_alias_header + old
elsif ... | [
"def",
"initialize_external_method",
"(",
"new",
",",
"old",
",",
"params",
",",
"file",
",",
"comment",
",",
"token",
"=",
"nil",
",",
"internal",
"=",
"nil",
",",
"nolink",
"=",
"nil",
")",
"return",
"nil",
"unless",
"new",
"||",
"old",
"if",
"intern... | Create method for external alias
If argument "internal" is true, file is ignored. | [
"Create",
"method",
"for",
"external",
"alias"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1194-L1220 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.check_external_aliases | def check_external_aliases(subname, params, comment, test=nil)
@@external_aliases.each{ |alias_item|
if subname == alias_item["old_name"] ||
subname.upcase == alias_item["old_name"].upcase &&
@options.ignore_case
new_meth = initialize_external_met... | ruby | def check_external_aliases(subname, params, comment, test=nil)
@@external_aliases.each{ |alias_item|
if subname == alias_item["old_name"] ||
subname.upcase == alias_item["old_name"].upcase &&
@options.ignore_case
new_meth = initialize_external_met... | [
"def",
"check_external_aliases",
"(",
"subname",
",",
"params",
",",
"comment",
",",
"test",
"=",
"nil",
")",
"@@external_aliases",
".",
"each",
"{",
"|",
"alias_item",
"|",
"if",
"subname",
"==",
"alias_item",
"[",
"\"old_name\"",
"]",
"||",
"subname",
".",... | Check external aliases | [
"Check",
"external",
"aliases"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1328-L1348 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.united_to_one_line | def united_to_one_line(f90src)
return "" unless f90src
lines = f90src.split("\n")
previous_continuing = false
now_continuing = false
body = ""
lines.each{ |line|
words = line.split("")
next if words.empty? && previous_continuing
commentout = false
bran... | ruby | def united_to_one_line(f90src)
return "" unless f90src
lines = f90src.split("\n")
previous_continuing = false
now_continuing = false
body = ""
lines.each{ |line|
words = line.split("")
next if words.empty? && previous_continuing
commentout = false
bran... | [
"def",
"united_to_one_line",
"(",
"f90src",
")",
"return",
"\"\"",
"unless",
"f90src",
"lines",
"=",
"f90src",
".",
"split",
"(",
"\"\\n\"",
")",
"previous_continuing",
"=",
"false",
"now_continuing",
"=",
"false",
"body",
"=",
"\"\"",
"lines",
".",
"each",
... | Continuous lines are united.
Comments in continuous lines are removed. | [
"Continuous",
"lines",
"are",
"united",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1387-L1455 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.continuous_line? | def continuous_line?(line)
continuous = false
if /&\s*?(!.*)?$/ =~ line
continuous = true
if comment_out?($~.pre_match)
continuous = false
end
end
return continuous
end | ruby | def continuous_line?(line)
continuous = false
if /&\s*?(!.*)?$/ =~ line
continuous = true
if comment_out?($~.pre_match)
continuous = false
end
end
return continuous
end | [
"def",
"continuous_line?",
"(",
"line",
")",
"continuous",
"=",
"false",
"if",
"/",
"\\s",
"/",
"=~",
"line",
"continuous",
"=",
"true",
"if",
"comment_out?",
"(",
"$~",
".",
"pre_match",
")",
"continuous",
"=",
"false",
"end",
"end",
"return",
"continuous... | Continuous line checker | [
"Continuous",
"line",
"checker"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1461-L1470 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.comment_out? | def comment_out?(line)
return nil unless line
commentout = false
squote = false ; dquote = false
line.split("").each { |char|
if !(squote) && !(dquote)
case char
when "!" ; commentout = true ; break
when "\""; dquote = true
when "\'"; squote = true... | ruby | def comment_out?(line)
return nil unless line
commentout = false
squote = false ; dquote = false
line.split("").each { |char|
if !(squote) && !(dquote)
case char
when "!" ; commentout = true ; break
when "\""; dquote = true
when "\'"; squote = true... | [
"def",
"comment_out?",
"(",
"line",
")",
"return",
"nil",
"unless",
"line",
"commentout",
"=",
"false",
"squote",
"=",
"false",
";",
"dquote",
"=",
"false",
"line",
".",
"split",
"(",
"\"\"",
")",
".",
"each",
"{",
"|",
"char",
"|",
"if",
"!",
"(",
... | Comment out checker | [
"Comment",
"out",
"checker"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1475-L1500 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.semicolon_to_linefeed | def semicolon_to_linefeed(text)
return "" unless text
lines = text.split("\n")
lines.collect!{ |line|
words = line.split("")
commentout = false
squote = false ; dquote = false
words.collect! { |char|
if !(squote) && !(dquote) && !(commentout)
case ... | ruby | def semicolon_to_linefeed(text)
return "" unless text
lines = text.split("\n")
lines.collect!{ |line|
words = line.split("")
commentout = false
squote = false ; dquote = false
words.collect! { |char|
if !(squote) && !(dquote) && !(commentout)
case ... | [
"def",
"semicolon_to_linefeed",
"(",
"text",
")",
"return",
"\"\"",
"unless",
"text",
"lines",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
"lines",
".",
"collect!",
"{",
"|",
"line",
"|",
"words",
"=",
"line",
".",
"split",
"(",
"\"\"",
")",
"comme... | Semicolons are replaced to line feed. | [
"Semicolons",
"are",
"replaced",
"to",
"line",
"feed",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1505-L1538 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.remove_empty_head_lines | def remove_empty_head_lines(text)
return "" unless text
lines = text.split("\n")
header = true
lines.delete_if{ |line|
header = false if /\S/ =~ line
header && /^\s*?$/ =~ line
}
lines.join("\n")
end | ruby | def remove_empty_head_lines(text)
return "" unless text
lines = text.split("\n")
header = true
lines.delete_if{ |line|
header = false if /\S/ =~ line
header && /^\s*?$/ =~ line
}
lines.join("\n")
end | [
"def",
"remove_empty_head_lines",
"(",
"text",
")",
"return",
"\"\"",
"unless",
"text",
"lines",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
"header",
"=",
"true",
"lines",
".",
"delete_if",
"{",
"|",
"line",
"|",
"header",
"=",
"false",
"if",
"/",
... | Empty lines in header are removed | [
"Empty",
"lines",
"in",
"header",
"are",
"removed"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1619-L1628 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.ZStream.end | def end
unless ready? then
warn "attempt to close uninitialized stream; ignored."
return nil
end
if in_stream? then
warn "attempt to close unfinished zstream; reset forced"
reset
end
reset_input
err = Zlib.send @func_end, pointer
Zlib.handle_... | ruby | def end
unless ready? then
warn "attempt to close uninitialized stream; ignored."
return nil
end
if in_stream? then
warn "attempt to close unfinished zstream; reset forced"
reset
end
reset_input
err = Zlib.send @func_end, pointer
Zlib.handle_... | [
"def",
"end",
"unless",
"ready?",
"then",
"warn",
"\"attempt to close uninitialized stream; ignored.\"",
"return",
"nil",
"end",
"if",
"in_stream?",
"then",
"warn",
"\"attempt to close unfinished zstream; reset forced\"",
"reset",
"end",
"reset_input",
"err",
"=",
"Zlib",
"... | Closes the stream. All operations on the closed stream will raise an
exception. | [
"Closes",
"the",
"stream",
".",
"All",
"operations",
"on",
"the",
"closed",
"stream",
"will",
"raise",
"an",
"exception",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L319-L344 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.ZStream.reset | def reset
err = Zlib.send @func_reset, pointer
Zlib.handle_error err, message
@flags = READY
reset_input
end | ruby | def reset
err = Zlib.send @func_reset, pointer
Zlib.handle_error err, message
@flags = READY
reset_input
end | [
"def",
"reset",
"err",
"=",
"Zlib",
".",
"send",
"@func_reset",
",",
"pointer",
"Zlib",
".",
"handle_error",
"err",
",",
"message",
"@flags",
"=",
"READY",
"reset_input",
"end"
] | Resets and initializes the stream. All data in both input and output
buffer are discarded. | [
"Resets",
"and",
"initializes",
"the",
"stream",
".",
"All",
"data",
"in",
"both",
"input",
"and",
"output",
"buffer",
"are",
"discarded",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L415-L423 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.Deflate.do_deflate | def do_deflate(data, flush)
if data.nil? then
run '', Zlib::FINISH
else
data = StringValue data
if flush != Zlib::NO_FLUSH or not data.empty? then # prevent BUF_ERROR
run data, flush
end
end
end | ruby | def do_deflate(data, flush)
if data.nil? then
run '', Zlib::FINISH
else
data = StringValue data
if flush != Zlib::NO_FLUSH or not data.empty? then # prevent BUF_ERROR
run data, flush
end
end
end | [
"def",
"do_deflate",
"(",
"data",
",",
"flush",
")",
"if",
"data",
".",
"nil?",
"then",
"run",
"''",
",",
"Zlib",
"::",
"FINISH",
"else",
"data",
"=",
"StringValue",
"data",
"if",
"flush",
"!=",
"Zlib",
"::",
"NO_FLUSH",
"or",
"not",
"data",
".",
"em... | Performs the deflate operation and leaves the compressed data in the
output buffer | [
"Performs",
"the",
"deflate",
"operation",
"and",
"leaves",
"the",
"compressed",
"data",
"in",
"the",
"output",
"buffer"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L654-L664 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.Deflate.params | def params(level, strategy)
err = Zlib.deflateParams pointer, level, strategy
raise Zlib::BufError, 'buffer expansion not implemented' if
err == Zlib::BUF_ERROR
Zlib.handle_error err, message
nil
end | ruby | def params(level, strategy)
err = Zlib.deflateParams pointer, level, strategy
raise Zlib::BufError, 'buffer expansion not implemented' if
err == Zlib::BUF_ERROR
Zlib.handle_error err, message
nil
end | [
"def",
"params",
"(",
"level",
",",
"strategy",
")",
"err",
"=",
"Zlib",
".",
"deflateParams",
"pointer",
",",
"level",
",",
"strategy",
"raise",
"Zlib",
"::",
"BufError",
",",
"'buffer expansion not implemented'",
"if",
"err",
"==",
"Zlib",
"::",
"BUF_ERROR",... | Changes the parameters of the deflate stream. See zlib.h for details.
The output from the stream by changing the params is preserved in output
buffer. | [
"Changes",
"the",
"parameters",
"of",
"the",
"deflate",
"stream",
".",
"See",
"zlib",
".",
"h",
"for",
"details",
".",
"The",
"output",
"from",
"the",
"stream",
"by",
"changing",
"the",
"params",
"is",
"preserved",
"in",
"output",
"buffer",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L692-L701 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.GzipReader.check_footer | def check_footer
@zstream.flags |= Zlib::GzipFile::FOOTER_FINISHED
footer = @zstream.input.slice! 0, 8
rest = @io.read 8 - footer.length
footer << rest if rest
raise NoFooter, 'footer is not found' unless footer.length == 8
crc, length = footer.unpack 'VV'
@zstream[:total_i... | ruby | def check_footer
@zstream.flags |= Zlib::GzipFile::FOOTER_FINISHED
footer = @zstream.input.slice! 0, 8
rest = @io.read 8 - footer.length
footer << rest if rest
raise NoFooter, 'footer is not found' unless footer.length == 8
crc, length = footer.unpack 'VV'
@zstream[:total_i... | [
"def",
"check_footer",
"@zstream",
".",
"flags",
"|=",
"Zlib",
"::",
"GzipFile",
"::",
"FOOTER_FINISHED",
"footer",
"=",
"@zstream",
".",
"input",
".",
"slice!",
"0",
",",
"8",
"rest",
"=",
"@io",
".",
"read",
"8",
"-",
"footer",
".",
"length",
"footer",... | HACK use a buffer class
Creates a GzipReader object associated with +io+. The GzipReader object
reads gzipped data from +io+, and parses/decompresses them. At least,
+io+ must have a +read+ method that behaves same as the +read+ method in
IO class.
If the gzip file header is incorrect, raises an Zlib::GzipFile:... | [
"HACK",
"use",
"a",
"buffer",
"class"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L961-L978 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.GzipWriter.make_header | def make_header
flags = 0
extra_flags = 0
flags |= Zlib::GzipFile::FLAG_ORIG_NAME if @orig_name
flags |= Zlib::GzipFile::FLAG_COMMENT if @comment
extra_flags |= Zlib::GzipFile::EXTRAFLAG_FAST if
@level == Zlib::BEST_SPEED
extra_flags |= Zlib::GzipFile::EXTRAFLAG_SLOW if
... | ruby | def make_header
flags = 0
extra_flags = 0
flags |= Zlib::GzipFile::FLAG_ORIG_NAME if @orig_name
flags |= Zlib::GzipFile::FLAG_COMMENT if @comment
extra_flags |= Zlib::GzipFile::EXTRAFLAG_FAST if
@level == Zlib::BEST_SPEED
extra_flags |= Zlib::GzipFile::EXTRAFLAG_SLOW if
... | [
"def",
"make_header",
"flags",
"=",
"0",
"extra_flags",
"=",
"0",
"flags",
"|=",
"Zlib",
"::",
"GzipFile",
"::",
"FLAG_ORIG_NAME",
"if",
"@orig_name",
"flags",
"|=",
"Zlib",
"::",
"GzipFile",
"::",
"FLAG_COMMENT",
"if",
"@comment",
"extra_flags",
"|=",
"Zlib",... | Writes out a gzip header | [
"Writes",
"out",
"a",
"gzip",
"header"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L1178-L1207 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.GzipWriter.make_footer | def make_footer
footer = [
@crc, # bytes 0-3
@zstream.total_in, # bytes 4-7
].pack 'VV'
@io.write footer
@zstream.flags |= Zlib::GzipFile::FOOTER_FINISHED
end | ruby | def make_footer
footer = [
@crc, # bytes 0-3
@zstream.total_in, # bytes 4-7
].pack 'VV'
@io.write footer
@zstream.flags |= Zlib::GzipFile::FOOTER_FINISHED
end | [
"def",
"make_footer",
"footer",
"=",
"[",
"@crc",
",",
"@zstream",
".",
"total_in",
",",
"]",
".",
"pack",
"'VV'",
"@io",
".",
"write",
"footer",
"@zstream",
".",
"flags",
"|=",
"Zlib",
"::",
"GzipFile",
"::",
"FOOTER_FINISHED",
"end"
] | Writes out a gzip footer | [
"Writes",
"out",
"a",
"gzip",
"footer"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L1212-L1221 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.GzipWriter.write | def write(data)
make_header unless header_finished?
data = String data
if data.length > 0 or sync? then
@crc = Zlib.crc32_c @crc, data, data.length
flush = sync? ? Zlib::SYNC_FLUSH : Zlib::NO_FLUSH
@zstream.run data, flush
end
write_raw
end | ruby | def write(data)
make_header unless header_finished?
data = String data
if data.length > 0 or sync? then
@crc = Zlib.crc32_c @crc, data, data.length
flush = sync? ? Zlib::SYNC_FLUSH : Zlib::NO_FLUSH
@zstream.run data, flush
end
write_raw
end | [
"def",
"write",
"(",
"data",
")",
"make_header",
"unless",
"header_finished?",
"data",
"=",
"String",
"data",
"if",
"data",
".",
"length",
">",
"0",
"or",
"sync?",
"then",
"@crc",
"=",
"Zlib",
".",
"crc32_c",
"@crc",
",",
"data",
",",
"data",
".",
"len... | Same as IO. | [
"Same",
"as",
"IO",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L1241-L1255 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb | Zlib.Inflate.<< | def <<(string)
string = StringValue string unless string.nil?
if finished? then
unless string.nil? then
@input ||= ''
@input << string
end
else
run string, Zlib::SYNC_FLUSH
end
end | ruby | def <<(string)
string = StringValue string unless string.nil?
if finished? then
unless string.nil? then
@input ||= ''
@input << string
end
else
run string, Zlib::SYNC_FLUSH
end
end | [
"def",
"<<",
"(",
"string",
")",
"string",
"=",
"StringValue",
"string",
"unless",
"string",
".",
"nil?",
"if",
"finished?",
"then",
"unless",
"string",
".",
"nil?",
"then",
"@input",
"||=",
"''",
"@input",
"<<",
"string",
"end",
"else",
"run",
"string",
... | Creates a new inflate stream for decompression. See zlib.h for details
of the argument. If +window_bits+ is +nil+, the default value is used.
Inputs +string+ into the inflate stream just like Zlib::Inflate#inflate,
but returns the Zlib::Inflate object itself. The output from the stream
is preserved in output buf... | [
"Creates",
"a",
"new",
"inflate",
"stream",
"for",
"decompression",
".",
"See",
"zlib",
".",
"h",
"for",
"details",
"of",
"the",
"argument",
".",
"If",
"+",
"window_bits",
"+",
"is",
"+",
"nil",
"+",
"the",
"default",
"value",
"is",
"used",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/shared/ffi/platform/i386-solaris/zlib.rb#L1327-L1338 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rexml/element.rb | REXML.Element.each_with_something | def each_with_something( test, max=0, name=nil )
num = 0
child=nil
@elements.each( name ){ |child|
yield child if test.call(child) and num += 1
return if max>0 and num == max
}
end | ruby | def each_with_something( test, max=0, name=nil )
num = 0
child=nil
@elements.each( name ){ |child|
yield child if test.call(child) and num += 1
return if max>0 and num == max
}
end | [
"def",
"each_with_something",
"(",
"test",
",",
"max",
"=",
"0",
",",
"name",
"=",
"nil",
")",
"num",
"=",
"0",
"child",
"=",
"nil",
"@elements",
".",
"each",
"(",
"name",
")",
"{",
"|",
"child",
"|",
"yield",
"child",
"if",
"test",
".",
"call",
... | A private helper method | [
"A",
"private",
"helper",
"method"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rexml/element.rb#L705-L712 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/xmlrpc/server.rb | XMLRPC.BasicServer.check_arity | def check_arity(obj, n_args)
ary = obj.arity
if ary >= 0
n_args == ary
else
n_args >= (ary+1).abs
end
end | ruby | def check_arity(obj, n_args)
ary = obj.arity
if ary >= 0
n_args == ary
else
n_args >= (ary+1).abs
end
end | [
"def",
"check_arity",
"(",
"obj",
",",
"n_args",
")",
"ary",
"=",
"obj",
".",
"arity",
"if",
"ary",
">=",
"0",
"n_args",
"==",
"ary",
"else",
"n_args",
">=",
"(",
"ary",
"+",
"1",
")",
".",
"abs",
"end",
"end"
] | returns true, if the arity of "obj" matches | [
"returns",
"true",
"if",
"the",
"arity",
"of",
"obj",
"matches"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/xmlrpc/server.rb#L354-L362 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/security.rb | Gem::Security.Policy.verify_gem | def verify_gem(signature, data, chain, time = Time.now)
Gem.ensure_ssl_available
cert_class = OpenSSL::X509::Certificate
exc = Gem::Security::Exception
chain ||= []
chain = chain.map{ |str| cert_class.new(str) }
signer, ch_len = chain[-1], chain.size
# make sure signature is ... | ruby | def verify_gem(signature, data, chain, time = Time.now)
Gem.ensure_ssl_available
cert_class = OpenSSL::X509::Certificate
exc = Gem::Security::Exception
chain ||= []
chain = chain.map{ |str| cert_class.new(str) }
signer, ch_len = chain[-1], chain.size
# make sure signature is ... | [
"def",
"verify_gem",
"(",
"signature",
",",
"data",
",",
"chain",
",",
"time",
"=",
"Time",
".",
"now",
")",
"Gem",
".",
"ensure_ssl_available",
"cert_class",
"=",
"OpenSSL",
"::",
"X509",
"::",
"Certificate",
"exc",
"=",
"Gem",
"::",
"Security",
"::",
"... | Verify that the gem data with the given signature and signing chain
matched this security policy at the specified time. | [
"Verify",
"that",
"the",
"gem",
"data",
"with",
"the",
"given",
"signature",
"and",
"signing",
"chain",
"matched",
"this",
"security",
"policy",
"at",
"the",
"specified",
"time",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/security.rb#L419-L509 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/yaml/yamlnode.rb | YAML.YamlNode.transform | def transform
t = nil
if @value.is_a? Hash
t = {}
@value.each { |k,v|
t[ k ] = v[1].transform
}
elsif @value.is_a? Array
t = []
@value.each { |v|
t.push v.transform... | ruby | def transform
t = nil
if @value.is_a? Hash
t = {}
@value.each { |k,v|
t[ k ] = v[1].transform
}
elsif @value.is_a? Array
t = []
@value.each { |v|
t.push v.transform... | [
"def",
"transform",
"t",
"=",
"nil",
"if",
"@value",
".",
"is_a?",
"Hash",
"t",
"=",
"{",
"}",
"@value",
".",
"each",
"{",
"|",
"k",
",",
"v",
"|",
"t",
"[",
"k",
"]",
"=",
"v",
"[",
"1",
"]",
".",
"transform",
"}",
"elsif",
"@value",
".",
... | Transform this node fully into a native type | [
"Transform",
"this",
"node",
"fully",
"into",
"a",
"native",
"type"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/yaml/yamlnode.rb#L34-L50 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.collect_first_comment | def collect_first_comment
skip_tkspace
res = ''
first_line = true
tk = get_tk
while tk.kind_of?(TkCOMMENT)
if first_line && /\A#!/ =~ tk.text
skip_tkspace
tk = get_tk
elsif first_line && /\A#\s*-\*-/ =~ tk.text
first_line = false
ski... | ruby | def collect_first_comment
skip_tkspace
res = ''
first_line = true
tk = get_tk
while tk.kind_of?(TkCOMMENT)
if first_line && /\A#!/ =~ tk.text
skip_tkspace
tk = get_tk
elsif first_line && /\A#\s*-\*-/ =~ tk.text
first_line = false
ski... | [
"def",
"collect_first_comment",
"skip_tkspace",
"res",
"=",
"''",
"first_line",
"=",
"true",
"tk",
"=",
"get_tk",
"while",
"tk",
".",
"kind_of?",
"(",
"TkCOMMENT",
")",
"if",
"first_line",
"&&",
"/",
"\\A",
"/",
"=~",
"tk",
".",
"text",
"skip_tkspace",
"tk... | Look for the first comment in a file that isn't
a shebang line. | [
"Look",
"for",
"the",
"first",
"comment",
"in",
"a",
"file",
"that",
"isn",
"t",
"a",
"shebang",
"line",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L1542-L1568 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.parse_method_parameters | def parse_method_parameters(method)
res = parse_method_or_yield_parameters(method)
res = "(" + res + ")" unless res[0] == ?(
method.params = res unless method.params
if method.block_params.nil?
skip_tkspace(false)
read_documentation_modifiers(method, METHOD_MODIFIERS)
end
... | ruby | def parse_method_parameters(method)
res = parse_method_or_yield_parameters(method)
res = "(" + res + ")" unless res[0] == ?(
method.params = res unless method.params
if method.block_params.nil?
skip_tkspace(false)
read_documentation_modifiers(method, METHOD_MODIFIERS)
end
... | [
"def",
"parse_method_parameters",
"(",
"method",
")",
"res",
"=",
"parse_method_or_yield_parameters",
"(",
"method",
")",
"res",
"=",
"\"(\"",
"+",
"res",
"+",
"\")\"",
"unless",
"res",
"[",
"0",
"]",
"==",
"?(",
"method",
".",
"params",
"=",
"res",
"unles... | Capture the method's parameters. Along the way,
look for a comment containing
# yields: ....
and add this as the block_params for the method | [
"Capture",
"the",
"method",
"s",
"parameters",
".",
"Along",
"the",
"way",
"look",
"for",
"a",
"comment",
"containing"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L2016-L2024 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.skip_optional_do_after_expression | def skip_optional_do_after_expression
skip_tkspace(false)
tk = get_tk
case tk
when TkLPAREN, TkfLPAREN
end_token = TkRPAREN
else
end_token = TkNL
end
nest = 0
@scanner.instance_eval{@continue = false}
loop do
puts("\nWhile: #{tk}, #{@scanne... | ruby | def skip_optional_do_after_expression
skip_tkspace(false)
tk = get_tk
case tk
when TkLPAREN, TkfLPAREN
end_token = TkRPAREN
else
end_token = TkNL
end
nest = 0
@scanner.instance_eval{@continue = false}
loop do
puts("\nWhile: #{tk}, #{@scanne... | [
"def",
"skip_optional_do_after_expression",
"skip_tkspace",
"(",
"false",
")",
"tk",
"=",
"get_tk",
"case",
"tk",
"when",
"TkLPAREN",
",",
"TkfLPAREN",
"end_token",
"=",
"TkRPAREN",
"else",
"end_token",
"=",
"TkNL",
"end",
"nest",
"=",
"0",
"@scanner",
".",
"i... | while, until, and for have an optional | [
"while",
"until",
"and",
"for",
"have",
"an",
"optional"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L2088-L2125 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.get_class_specification | def get_class_specification
tk = get_tk
return "self" if tk.kind_of?(TkSELF)
res = ""
while tk.kind_of?(TkCOLON2) ||
tk.kind_of?(TkCOLON3) ||
tk.kind_of?(TkCONSTANT)
res += tk.text
tk = get_tk
end
unget_tk(tk)
skip_tks... | ruby | def get_class_specification
tk = get_tk
return "self" if tk.kind_of?(TkSELF)
res = ""
while tk.kind_of?(TkCOLON2) ||
tk.kind_of?(TkCOLON3) ||
tk.kind_of?(TkCONSTANT)
res += tk.text
tk = get_tk
end
unget_tk(tk)
skip_tks... | [
"def",
"get_class_specification",
"tk",
"=",
"get_tk",
"return",
"\"self\"",
"if",
"tk",
".",
"kind_of?",
"(",
"TkSELF",
")",
"res",
"=",
"\"\"",
"while",
"tk",
".",
"kind_of?",
"(",
"TkCOLON2",
")",
"||",
"tk",
".",
"kind_of?",
"(",
"TkCOLON3",
")",
"||... | Return a superclass, which can be either a constant
of an expression | [
"Return",
"a",
"superclass",
"which",
"can",
"be",
"either",
"a",
"constant",
"of",
"an",
"expression"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L2130-L2158 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.get_constant | def get_constant
res = ""
skip_tkspace(false)
tk = get_tk
while tk.kind_of?(TkCOLON2) ||
tk.kind_of?(TkCOLON3) ||
tk.kind_of?(TkCONSTANT)
res += tk.text
tk = get_tk
end
# if res.empty?
# warn("Unexpected token #{tk} in ... | ruby | def get_constant
res = ""
skip_tkspace(false)
tk = get_tk
while tk.kind_of?(TkCOLON2) ||
tk.kind_of?(TkCOLON3) ||
tk.kind_of?(TkCONSTANT)
res += tk.text
tk = get_tk
end
# if res.empty?
# warn("Unexpected token #{tk} in ... | [
"def",
"get_constant",
"res",
"=",
"\"\"",
"skip_tkspace",
"(",
"false",
")",
"tk",
"=",
"get_tk",
"while",
"tk",
".",
"kind_of?",
"(",
"TkCOLON2",
")",
"||",
"tk",
".",
"kind_of?",
"(",
"TkCOLON3",
")",
"||",
"tk",
".",
"kind_of?",
"(",
"TkCONSTANT",
... | Parse a constant, which might be qualified by
one or more class or module names | [
"Parse",
"a",
"constant",
"which",
"might",
"be",
"qualified",
"by",
"one",
"or",
"more",
"class",
"or",
"module",
"names"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L2202-L2220 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.get_constant_with_optional_parens | def get_constant_with_optional_parens
skip_tkspace(false)
nest = 0
while (tk = peek_tk).kind_of?(TkLPAREN) || tk.kind_of?(TkfLPAREN)
get_tk
skip_tkspace(true)
nest += 1
end
name = get_constant
while nest > 0
skip_tkspace(true)
tk = get_tk
... | ruby | def get_constant_with_optional_parens
skip_tkspace(false)
nest = 0
while (tk = peek_tk).kind_of?(TkLPAREN) || tk.kind_of?(TkfLPAREN)
get_tk
skip_tkspace(true)
nest += 1
end
name = get_constant
while nest > 0
skip_tkspace(true)
tk = get_tk
... | [
"def",
"get_constant_with_optional_parens",
"skip_tkspace",
"(",
"false",
")",
"nest",
"=",
"0",
"while",
"(",
"tk",
"=",
"peek_tk",
")",
".",
"kind_of?",
"(",
"TkLPAREN",
")",
"||",
"tk",
".",
"kind_of?",
"(",
"TkfLPAREN",
")",
"get_tk",
"skip_tkspace",
"("... | Get a constant that may be surrounded by parens | [
"Get",
"a",
"constant",
"that",
"may",
"be",
"surrounded",
"by",
"parens"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L2224-L2241 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb | RDoc.RubyParser.read_directive | def read_directive(allowed)
tk = get_tk
puts "directive: #{tk.inspect}" if $DEBUG
result = nil
if tk.kind_of?(TkCOMMENT)
if tk.text =~ /\s*:?(\w+):\s*(.*)/
directive = $1.downcase
if allowed.include?(directive)
result = [directive, $2]
end
... | ruby | def read_directive(allowed)
tk = get_tk
puts "directive: #{tk.inspect}" if $DEBUG
result = nil
if tk.kind_of?(TkCOMMENT)
if tk.text =~ /\s*:?(\w+):\s*(.*)/
directive = $1.downcase
if allowed.include?(directive)
result = [directive, $2]
end
... | [
"def",
"read_directive",
"(",
"allowed",
")",
"tk",
"=",
"get_tk",
"puts",
"\"directive: #{tk.inspect}\"",
"if",
"$DEBUG",
"result",
"=",
"nil",
"if",
"tk",
".",
"kind_of?",
"(",
"TkCOMMENT",
")",
"if",
"tk",
".",
"text",
"=~",
"/",
"\\s",
"\\w",
"\\s",
... | Directives are modifier comments that can appear after class, module,
or method names. For example
def fred # :yields: a, b
or
class SM # :nodoc:
we return the directive name and any parameters as a two element array | [
"Directives",
"are",
"modifier",
"comments",
"that",
"can",
"appear",
"after",
"class",
"module",
"or",
"method",
"names",
".",
"For",
"example"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_rb.rb#L2254-L2269 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/soap/wsdlDriver.rb | SOAP.WSDLDriverFactory.create_driver | def create_driver(servicename = nil, portname = nil)
warn("WSDLDriverFactory#create_driver is depricated. Use create_rpc_driver instead.")
port = find_port(servicename, portname)
WSDLDriver.new(@wsdl, port, nil)
end | ruby | def create_driver(servicename = nil, portname = nil)
warn("WSDLDriverFactory#create_driver is depricated. Use create_rpc_driver instead.")
port = find_port(servicename, portname)
WSDLDriver.new(@wsdl, port, nil)
end | [
"def",
"create_driver",
"(",
"servicename",
"=",
"nil",
",",
"portname",
"=",
"nil",
")",
"warn",
"(",
"\"WSDLDriverFactory#create_driver is depricated. Use create_rpc_driver instead.\"",
")",
"port",
"=",
"find_port",
"(",
"servicename",
",",
"portname",
")",
"WSDLDri... | depricated old interface | [
"depricated",
"old",
"interface"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/soap/wsdlDriver.rb#L45-L49 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.MarkUp.markup | def markup(str, remove_para=false)
return '' unless str
unless defined? @markup
@markup = SM::SimpleMarkup.new
# class names, variable names, or instance variables
@markup.add_special(/(
\w+(::\w+)*[.\#]\w+(\([\.\w+\*\/\+\-\=\<\>]+\))? # A::B.meth(**)... | ruby | def markup(str, remove_para=false)
return '' unless str
unless defined? @markup
@markup = SM::SimpleMarkup.new
# class names, variable names, or instance variables
@markup.add_special(/(
\w+(::\w+)*[.\#]\w+(\([\.\w+\*\/\+\-\=\<\>]+\))? # A::B.meth(**)... | [
"def",
"markup",
"(",
"str",
",",
"remove_para",
"=",
"false",
")",
"return",
"''",
"unless",
"str",
"unless",
"defined?",
"@markup",
"@markup",
"=",
"SM",
"::",
"SimpleMarkup",
".",
"new",
"@markup",
".",
"add_special",
"(",
"/",
"\\w",
"\\w",
"\\#",
"\... | Convert a string in markup format into HTML. We keep a cached
SimpleMarkup object lying around after the first time we're
called per object. | [
"Convert",
"a",
"string",
"in",
"markup",
"format",
"into",
"HTML",
".",
"We",
"keep",
"a",
"cached",
"SimpleMarkup",
"object",
"lying",
"around",
"after",
"the",
"first",
"time",
"we",
"re",
"called",
"per",
"object",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L209-L252 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.ContextUser.build_method_detail_list | def build_method_detail_list(section)
outer = []
methods = @methods.sort
for singleton in [true, false]
for vis in [ :public, :protected, :private ]
res = []
methods.each do |m|
if m.section == section and
m.document_self and
m... | ruby | def build_method_detail_list(section)
outer = []
methods = @methods.sort
for singleton in [true, false]
for vis in [ :public, :protected, :private ]
res = []
methods.each do |m|
if m.section == section and
m.document_self and
m... | [
"def",
"build_method_detail_list",
"(",
"section",
")",
"outer",
"=",
"[",
"]",
"methods",
"=",
"@methods",
".",
"sort",
"for",
"singleton",
"in",
"[",
"true",
",",
"false",
"]",
"for",
"vis",
"in",
"[",
":public",
",",
":protected",
",",
":private",
"]"... | Build an array of arrays of method details. The outer array has up
to six entries, public, private, and protected for both class
methods, the other for instance methods. The inner arrays contain
a hash for each method | [
"Build",
"an",
"array",
"of",
"arrays",
"of",
"method",
"details",
".",
"The",
"outer",
"array",
"has",
"up",
"to",
"six",
"entries",
"public",
"private",
"and",
"protected",
"for",
"both",
"class",
"methods",
"the",
"other",
"for",
"instance",
"methods",
... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L432-L492 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.ContextUser.build_class_list | def build_class_list(level, from, section, infile=nil)
res = ""
prefix = " ::" * level;
from.modules.sort.each do |mod|
next unless mod.section == section
next if infile && !mod.defined_in?(infile)
if mod.document_self
res <<
prefix <<
... | ruby | def build_class_list(level, from, section, infile=nil)
res = ""
prefix = " ::" * level;
from.modules.sort.each do |mod|
next unless mod.section == section
next if infile && !mod.defined_in?(infile)
if mod.document_self
res <<
prefix <<
... | [
"def",
"build_class_list",
"(",
"level",
",",
"from",
",",
"section",
",",
"infile",
"=",
"nil",
")",
"res",
"=",
"\"\"",
"prefix",
"=",
"\" ::\"",
"*",
"level",
";",
"from",
".",
"modules",
".",
"sort",
".",
"each",
"do",
"|",
"mod",
"|",
... | Build the structured list of classes and modules contained
in this context. | [
"Build",
"the",
"structured",
"list",
"of",
"classes",
"and",
"modules",
"contained",
"in",
"this",
"context",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L497-L528 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.HTMLGenerator.load_html_template | def load_html_template
template = @options.template
unless template =~ %r{/|\\}
template = File.join("rdoc/generators/template",
@options.generator.key, template)
end
require template
extend RDoc::Page
rescue LoadError
$stderr.puts "Could not ... | ruby | def load_html_template
template = @options.template
unless template =~ %r{/|\\}
template = File.join("rdoc/generators/template",
@options.generator.key, template)
end
require template
extend RDoc::Page
rescue LoadError
$stderr.puts "Could not ... | [
"def",
"load_html_template",
"template",
"=",
"@options",
".",
"template",
"unless",
"template",
"=~",
"%r{",
"\\\\",
"}",
"template",
"=",
"File",
".",
"join",
"(",
"\"rdoc/generators/template\"",
",",
"@options",
".",
"generator",
".",
"key",
",",
"template",
... | Load up the HTML template specified in the options.
If the template name contains a slash, use it literally | [
"Load",
"up",
"the",
"HTML",
"template",
"specified",
"in",
"the",
"options",
".",
"If",
"the",
"template",
"name",
"contains",
"a",
"slash",
"use",
"it",
"literally"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L1206-L1217 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.HTMLGenerator.write_style_sheet | def write_style_sheet
template = TemplatePage.new(RDoc::Page::STYLE)
unless @options.css
File.open(CSS_NAME, "w") do |f|
values = { "fonts" => RDoc::Page::FONTS }
template.write_html_on(f, values)
end
end
end | ruby | def write_style_sheet
template = TemplatePage.new(RDoc::Page::STYLE)
unless @options.css
File.open(CSS_NAME, "w") do |f|
values = { "fonts" => RDoc::Page::FONTS }
template.write_html_on(f, values)
end
end
end | [
"def",
"write_style_sheet",
"template",
"=",
"TemplatePage",
".",
"new",
"(",
"RDoc",
"::",
"Page",
"::",
"STYLE",
")",
"unless",
"@options",
".",
"css",
"File",
".",
"open",
"(",
"CSS_NAME",
",",
"\"w\"",
")",
"do",
"|",
"f",
"|",
"values",
"=",
"{",
... | Write out the style sheet used by the main frames | [
"Write",
"out",
"the",
"style",
"sheet",
"used",
"by",
"the",
"main",
"frames"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L1223-L1231 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.HTMLGenerator.main_url | def main_url
main_page = @options.main_page
ref = nil
if main_page
ref = AllReferences[main_page]
if ref
ref = ref.path
else
$stderr.puts "Could not find main page #{main_page}"
end
end
unless ref
for file in @files
if ... | ruby | def main_url
main_page = @options.main_page
ref = nil
if main_page
ref = AllReferences[main_page]
if ref
ref = ref.path
else
$stderr.puts "Could not find main page #{main_page}"
end
end
unless ref
for file in @files
if ... | [
"def",
"main_url",
"main_page",
"=",
"@options",
".",
"main_page",
"ref",
"=",
"nil",
"if",
"main_page",
"ref",
"=",
"AllReferences",
"[",
"main_page",
"]",
"if",
"ref",
"ref",
"=",
"ref",
".",
"path",
"else",
"$stderr",
".",
"puts",
"\"Could not find main p... | return the url of the main page | [
"return",
"the",
"url",
"of",
"the",
"main",
"page"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L1361-L1389 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb | Generators.HTMLGeneratorInOne.generate_xml | def generate_xml
values = {
'charset' => @options.charset,
'files' => gen_into(@files),
'classes' => gen_into(@classes),
'title' => CGI.escapeHTML(@options.title),
}
# this method is defined in the template file
write_extra_pages if defined? write... | ruby | def generate_xml
values = {
'charset' => @options.charset,
'files' => gen_into(@files),
'classes' => gen_into(@classes),
'title' => CGI.escapeHTML(@options.title),
}
# this method is defined in the template file
write_extra_pages if defined? write... | [
"def",
"generate_xml",
"values",
"=",
"{",
"'charset'",
"=>",
"@options",
".",
"charset",
",",
"'files'",
"=>",
"gen_into",
"(",
"@files",
")",
",",
"'classes'",
"=>",
"gen_into",
"(",
"@classes",
")",
",",
"'title'",
"=>",
"CGI",
".",
"escapeHTML",
"(",
... | Generate all the HTML. For the one-file case, we generate
all the information in to one big hash | [
"Generate",
"all",
"the",
"HTML",
".",
"For",
"the",
"one",
"-",
"file",
"case",
"we",
"generate",
"all",
"the",
"information",
"in",
"to",
"one",
"big",
"hash"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/generators/html_generator.rb#L1451-L1470 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/diagram.rb | RDoc.Diagram.draw | def draw
unless @options.quiet
$stderr.print "Diagrams: "
$stderr.flush
end
@info.each_with_index do |i, file_count|
@done_modules = {}
@local_names = find_names(i)
@global_names = []
@global_graph = graph = DOT::Digraph.new('name' => 'TopLevel',
... | ruby | def draw
unless @options.quiet
$stderr.print "Diagrams: "
$stderr.flush
end
@info.each_with_index do |i, file_count|
@done_modules = {}
@local_names = find_names(i)
@global_names = []
@global_graph = graph = DOT::Digraph.new('name' => 'TopLevel',
... | [
"def",
"draw",
"unless",
"@options",
".",
"quiet",
"$stderr",
".",
"print",
"\"Diagrams: \"",
"$stderr",
".",
"flush",
"end",
"@info",
".",
"each_with_index",
"do",
"|",
"i",
",",
"file_count",
"|",
"@done_modules",
"=",
"{",
"}",
"@local_names",
"=",
"find_... | Pass in the set of top level objects. The method also creates the
subdirectory to hold the images
Draw the diagrams. We traverse the files, drawing a diagram for each. We
also traverse each top-level class and module in that file drawing a
diagram for these too. | [
"Pass",
"in",
"the",
"set",
"of",
"top",
"level",
"objects",
".",
"The",
"method",
"also",
"creates",
"the",
"subdirectory",
"to",
"hold",
"the",
"images"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/diagram.rb#L50-L103 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/code_objects.rb | RDoc.Context.find_symbol | def find_symbol(symbol, method=nil)
result = nil
case symbol
when /^::(.*)/
result = toplevel.find_symbol($1)
when /::/
modules = symbol.split(/::/)
unless modules.empty?
module_name = modules.shift
result = find_module_named(module_name)
if ... | ruby | def find_symbol(symbol, method=nil)
result = nil
case symbol
when /^::(.*)/
result = toplevel.find_symbol($1)
when /::/
modules = symbol.split(/::/)
unless modules.empty?
module_name = modules.shift
result = find_module_named(module_name)
if ... | [
"def",
"find_symbol",
"(",
"symbol",
",",
"method",
"=",
"nil",
")",
"result",
"=",
"nil",
"case",
"symbol",
"when",
"/",
"/",
"result",
"=",
"toplevel",
".",
"find_symbol",
"(",
"$1",
")",
"when",
"/",
"/",
"modules",
"=",
"symbol",
".",
"split",
"(... | allow us to sort modules by name
Look up the given symbol. If method is non-nil, then
we assume the symbol references a module that
contains that method | [
"allow",
"us",
"to",
"sort",
"modules",
"by",
"name",
"Look",
"up",
"the",
"given",
"symbol",
".",
"If",
"method",
"is",
"non",
"-",
"nil",
"then",
"we",
"assume",
"the",
"symbol",
"references",
"a",
"module",
"that",
"contains",
"that",
"method"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/code_objects.rb#L377-L420 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/message_verifier.rb | ActiveSupport.MessageVerifier.secure_compare | def secure_compare(a, b)
if a.length == b.length
result = 0
for i in 0..(a.length - 1)
result |= a[i] ^ b[i]
end
result == 0
else
false
end
end | ruby | def secure_compare(a, b)
if a.length == b.length
result = 0
for i in 0..(a.length - 1)
result |= a[i] ^ b[i]
end
result == 0
else
false
end
end | [
"def",
"secure_compare",
"(",
"a",
",",
"b",
")",
"if",
"a",
".",
"length",
"==",
"b",
".",
"length",
"result",
"=",
"0",
"for",
"i",
"in",
"0",
"..",
"(",
"a",
".",
"length",
"-",
"1",
")",
"result",
"|=",
"a",
"[",
"i",
"]",
"^",
"b",
"["... | constant-time comparison algorithm to prevent timing attacks | [
"constant",
"-",
"time",
"comparison",
"algorithm",
"to",
"prevent",
"timing",
"attacks"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/message_verifier.rb#L42-L52 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rss/parser.rb | RSS.ListenerMixin.parse_pi_content | def parse_pi_content(content)
params = {}
content.scan(CONTENT_PATTERN) do |name, quote, value|
params[name] = value
end
params
end | ruby | def parse_pi_content(content)
params = {}
content.scan(CONTENT_PATTERN) do |name, quote, value|
params[name] = value
end
params
end | [
"def",
"parse_pi_content",
"(",
"content",
")",
"params",
"=",
"{",
"}",
"content",
".",
"scan",
"(",
"CONTENT_PATTERN",
")",
"do",
"|",
"name",
",",
"quote",
",",
"value",
"|",
"params",
"[",
"name",
"]",
"=",
"value",
"end",
"params",
"end"
] | Extract the first name="value" pair from content.
Works with single quotes according to the constant
CONTENT_PATTERN. Return a Hash. | [
"Extract",
"the",
"first",
"name",
"=",
"value",
"pair",
"from",
"content",
".",
"Works",
"with",
"single",
"quotes",
"according",
"to",
"the",
"constant",
"CONTENT_PATTERN",
".",
"Return",
"a",
"Hash",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rss/parser.rb#L379-L385 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rss/parser.rb | RSS.Parser.normalize_rss | def normalize_rss(rss)
return rss if maybe_xml?(rss)
uri = to_uri(rss)
if uri.respond_to?(:read)
uri.read
elsif !rss.tainted? and File.readable?(rss)
File.open(rss) {|f| f.read}
else
rss
end
end | ruby | def normalize_rss(rss)
return rss if maybe_xml?(rss)
uri = to_uri(rss)
if uri.respond_to?(:read)
uri.read
elsif !rss.tainted? and File.readable?(rss)
File.open(rss) {|f| f.read}
else
rss
end
end | [
"def",
"normalize_rss",
"(",
"rss",
")",
"return",
"rss",
"if",
"maybe_xml?",
"(",
"rss",
")",
"uri",
"=",
"to_uri",
"(",
"rss",
")",
"if",
"uri",
".",
"respond_to?",
"(",
":read",
")",
"uri",
".",
"read",
"elsif",
"!",
"rss",
".",
"tainted?",
"and",... | Try to get the XML associated with +rss+.
Return +rss+ if it already looks like XML, or treat it as a URI,
or a file to get the XML, | [
"Try",
"to",
"get",
"the",
"XML",
"associated",
"with",
"+",
"rss",
"+",
".",
"Return",
"+",
"rss",
"+",
"if",
"it",
"already",
"looks",
"like",
"XML",
"or",
"treat",
"it",
"as",
"a",
"URI",
"or",
"a",
"file",
"to",
"get",
"the",
"XML"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rss/parser.rb#L97-L109 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rcov-0.9.8-java/lib/rcov/rcovtask.rb | Rcov.RcovTask.define | def define
lib_path = @libs.join(File::PATH_SEPARATOR)
actual_name = Hash === name ? name.keys.first : name
unless Rake.application.last_comment
desc "Analyze code coverage with tests" +
(@name==:rcov ? "" : " for #{actual_name}")
end
task @name do
run_code = ''
... | ruby | def define
lib_path = @libs.join(File::PATH_SEPARATOR)
actual_name = Hash === name ? name.keys.first : name
unless Rake.application.last_comment
desc "Analyze code coverage with tests" +
(@name==:rcov ? "" : " for #{actual_name}")
end
task @name do
run_code = ''
... | [
"def",
"define",
"lib_path",
"=",
"@libs",
".",
"join",
"(",
"File",
"::",
"PATH_SEPARATOR",
")",
"actual_name",
"=",
"Hash",
"===",
"name",
"?",
"name",
".",
"keys",
".",
"first",
":",
"name",
"unless",
"Rake",
".",
"application",
".",
"last_comment",
"... | Create a testing task.
Create the tasks defined by this task lib. | [
"Create",
"a",
"testing",
"task",
".",
"Create",
"the",
"tasks",
"defined",
"by",
"this",
"task",
"lib",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rcov-0.9.8-java/lib/rcov/rcovtask.rb#L98-L134 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb | RDoc.RDoc.update_output_dir | def update_output_dir(op_dir, time)
File.open(output_flag_file(op_dir), "w") {|f| f.puts time.rfc2822 }
end | ruby | def update_output_dir(op_dir, time)
File.open(output_flag_file(op_dir), "w") {|f| f.puts time.rfc2822 }
end | [
"def",
"update_output_dir",
"(",
"op_dir",
",",
"time",
")",
"File",
".",
"open",
"(",
"output_flag_file",
"(",
"op_dir",
")",
",",
"\"w\"",
")",
"{",
"|",
"f",
"|",
"f",
".",
"puts",
"time",
".",
"rfc2822",
"}",
"end"
] | Update the flag file in an output directory. | [
"Update",
"the",
"flag",
"file",
"in",
"an",
"output",
"directory",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb#L105-L107 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb | RDoc.RDoc.normalized_file_list | def normalized_file_list(options, relative_files, force_doc = false,
exclude_pattern = nil)
file_list = []
relative_files.each do |rel_file_name|
next if exclude_pattern && exclude_pattern =~ rel_file_name
stat = File.stat(rel_file_name)
case type = stat... | ruby | def normalized_file_list(options, relative_files, force_doc = false,
exclude_pattern = nil)
file_list = []
relative_files.each do |rel_file_name|
next if exclude_pattern && exclude_pattern =~ rel_file_name
stat = File.stat(rel_file_name)
case type = stat... | [
"def",
"normalized_file_list",
"(",
"options",
",",
"relative_files",
",",
"force_doc",
"=",
"false",
",",
"exclude_pattern",
"=",
"nil",
")",
"file_list",
"=",
"[",
"]",
"relative_files",
".",
"each",
"do",
"|",
"rel_file_name",
"|",
"next",
"if",
"exclude_pa... | Given a list of files and directories, create a list of all the Ruby
files they contain.
If +force_doc+ is true we always add the given files, if false, only
add files that we guarantee we can parse. It is true when looking at
files given on the command line, false when recursing through
subdirectories.
The ef... | [
"Given",
"a",
"list",
"of",
"files",
"and",
"directories",
"create",
"a",
"list",
"of",
"all",
"the",
"Ruby",
"files",
"they",
"contain",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb#L146-L174 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb | RDoc.RDoc.list_files_in_directory | def list_files_in_directory(dir, options)
files = Dir.glob File.join(dir, "*")
normalized_file_list options, files, false, options.exclude
end | ruby | def list_files_in_directory(dir, options)
files = Dir.glob File.join(dir, "*")
normalized_file_list options, files, false, options.exclude
end | [
"def",
"list_files_in_directory",
"(",
"dir",
",",
"options",
")",
"files",
"=",
"Dir",
".",
"glob",
"File",
".",
"join",
"(",
"dir",
",",
"\"*\"",
")",
"normalized_file_list",
"options",
",",
"files",
",",
"false",
",",
"options",
".",
"exclude",
"end"
] | Return a list of the files to be processed in a directory. We know that
this directory doesn't have a .document file, so we're looking for real
files. However we may well contain subdirectories which must be tested
for .document files. | [
"Return",
"a",
"list",
"of",
"the",
"files",
"to",
"be",
"processed",
"in",
"a",
"directory",
".",
"We",
"know",
"that",
"this",
"directory",
"doesn",
"t",
"have",
"a",
".",
"document",
"file",
"so",
"we",
"re",
"looking",
"for",
"real",
"files",
".",
... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb#L182-L186 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb | RDoc.RDoc.parse_files | def parse_files(options)
@stats = Stats.new options.verbosity
files = options.files
files = ["."] if files.empty?
file_list = normalized_file_list(options, files, true, options.exclude)
return [] if file_list.empty?
file_info = []
file_list.each do |filename|
@stat... | ruby | def parse_files(options)
@stats = Stats.new options.verbosity
files = options.files
files = ["."] if files.empty?
file_list = normalized_file_list(options, files, true, options.exclude)
return [] if file_list.empty?
file_info = []
file_list.each do |filename|
@stat... | [
"def",
"parse_files",
"(",
"options",
")",
"@stats",
"=",
"Stats",
".",
"new",
"options",
".",
"verbosity",
"files",
"=",
"options",
".",
"files",
"files",
"=",
"[",
"\".\"",
"]",
"if",
"files",
".",
"empty?",
"file_list",
"=",
"normalized_file_list",
"(",... | Parse each file on the command line, recursively entering directories. | [
"Parse",
"each",
"file",
"on",
"the",
"command",
"line",
"recursively",
"entering",
"directories",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb#L191-L229 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb | RDoc.RDoc.document | def document(argv)
TopLevel::reset
@options = Options.new GENERATORS
@options.parse argv
@last_created = nil
unless @options.all_one_file then
@last_created = setup_output_dir @options.op_dir, @options.force_update
end
start_time = Time.now
file_info = parse_... | ruby | def document(argv)
TopLevel::reset
@options = Options.new GENERATORS
@options.parse argv
@last_created = nil
unless @options.all_one_file then
@last_created = setup_output_dir @options.op_dir, @options.force_update
end
start_time = Time.now
file_info = parse_... | [
"def",
"document",
"(",
"argv",
")",
"TopLevel",
"::",
"reset",
"@options",
"=",
"Options",
".",
"new",
"GENERATORS",
"@options",
".",
"parse",
"argv",
"@last_created",
"=",
"nil",
"unless",
"@options",
".",
"all_one_file",
"then",
"@last_created",
"=",
"setup... | Format up one or more files according to the given arguments.
For simplicity, _argv_ is an array of strings, equivalent to the strings
that would be passed on the command line. (This isn't a coincidence, as
we _do_ pass in ARGV when running interactively). For a list of options,
see rdoc/rdoc.rb. By default, outpu... | [
"Format",
"up",
"one",
"or",
"more",
"files",
"according",
"to",
"the",
"given",
"arguments",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/rdoc.rb#L243-L290 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rss/utils.rb | RSS.Utils.new_with_value_if_need | def new_with_value_if_need(klass, value)
if value.is_a?(klass)
value
else
klass.new(value)
end
end | ruby | def new_with_value_if_need(klass, value)
if value.is_a?(klass)
value
else
klass.new(value)
end
end | [
"def",
"new_with_value_if_need",
"(",
"klass",
",",
"value",
")",
"if",
"value",
".",
"is_a?",
"(",
"klass",
")",
"value",
"else",
"klass",
".",
"new",
"(",
"value",
")",
"end",
"end"
] | If +value+ is an instance of class +klass+, return it, else
create a new instance of +klass+ with value +value+. | [
"If",
"+",
"value",
"+",
"is",
"an",
"instance",
"of",
"class",
"+",
"klass",
"+",
"return",
"it",
"else",
"create",
"a",
"new",
"instance",
"of",
"+",
"klass",
"+",
"with",
"value",
"+",
"value",
"+",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rss/utils.rb#L27-L33 | train |
ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/rdoc/code_objects.rb | RDoc.Context.methods_matching | def methods_matching(methods, singleton = false)
count = 0
@method_list.each do |m|
if methods.include? m.name and m.singleton == singleton then
yield m
count += 1
end
end
return if count == methods.size || singleton
# perhaps we need to look at attri... | ruby | def methods_matching(methods, singleton = false)
count = 0
@method_list.each do |m|
if methods.include? m.name and m.singleton == singleton then
yield m
count += 1
end
end
return if count == methods.size || singleton
# perhaps we need to look at attri... | [
"def",
"methods_matching",
"(",
"methods",
",",
"singleton",
"=",
"false",
")",
"count",
"=",
"0",
"@method_list",
".",
"each",
"do",
"|",
"m",
"|",
"if",
"methods",
".",
"include?",
"m",
".",
"name",
"and",
"m",
".",
"singleton",
"==",
"singleton",
"t... | Yields Method and Attr entries matching the list of names in +methods+.
Attributes are only returned when +singleton+ is false. | [
"Yields",
"Method",
"and",
"Attr",
"entries",
"matching",
"the",
"list",
"of",
"names",
"in",
"+",
"methods",
"+",
".",
"Attributes",
"are",
"only",
"returned",
"when",
"+",
"singleton",
"+",
"is",
"false",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/rdoc/code_objects.rb#L249-L266 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.