Skip to content

Instantly share code, notes, and snippets.

@banister

banister/b.rb Secret

Created June 22, 2012 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/85fad64af55e7c11c460 to your computer and use it in GitHub Desktop.
Save banister/85fad64af55e7c11c460 to your computer and use it in GitHub Desktop.
[30] (pry) main: 0> show-source -a Array -f
Found 5 candidates for `Array` definition:
Candidate 1/5: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/syck/rubytypes.rb @ line 105:
Number of lines: 15
class Array
yaml_as "tag:ruby.yaml.org,2002:array"
yaml_as "tag:yaml.org,2002:seq"
def yaml_initialize( tag, val ); concat( val.to_a ); end
def to_yaml( opts = {} )
return super unless YAML::ENGINE.syck?
YAML::quick_emit( self, opts ) do |out|
out.seq( taguri, to_yaml_style ) do |seq|
each do |x|
seq.add( x )
end
end
end
end
end
Candidate 3/5: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/pp.rb @ line 335:
Number of lines: 13
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
def pretty_print_cycle(q)
q.text(empty? ? '[]' : '[...]')
end
end
Candidate 4/5: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/shellwords.rb @ line 144:
Number of lines: 13
class Array
#
# call-seq:
# array.shelljoin => string
#
# Builds a command line string from an argument list +array+ joining
# all elements escaped for Bourne shell and separated by a space.
# See +Shellwords::shelljoin+ for details.
#
def shelljoin
Shellwords.join(self)
end
end
Candidate 5/5: /Users/john/.rvm/gems/ruby-1.9.2-p180/gems/yard-0.8.2.1/lib/yard/core_ext/array.rb @ line 1:
Number of lines: 15
class Array
# Places values before or after another object (by value) in
# an array. This is used in tandem with the before and after
# methods of the {Insertion} class.
#
# @example Places an item before another
# [1, 2, 3].place(4).before(3) # => [1, 2, 4, 3]
# @example Places an item after another
# [:a, :b, :c].place(:x).after(:a) # => [:a, :x, :b, :c]
# @param [Array] values value to insert
# @return [Insertion] an insertion object to
# @see Insertion#before
# @see Insertion#after
def place(*values) Insertion.new(self, values) end
end
[31] (pry) main: 0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment