zucker 13.1 → 100.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +17 -2
- data/MIT-LICENSE +1 -1
- data/README.md +22 -0
- data/Rakefile +17 -58
- data/doc/{zucker_doc.rb → create_documentation.rb} +67 -129
- data/doc/zucker.html +1774 -0
- data/lib/zucker.rb +12 -42
- data/lib/zucker/alias_for.rb +9 -16
- data/lib/zucker/all.rb +0 -2
- data/lib/zucker/array_op.rb +15 -0
- data/lib/zucker/blank.rb +39 -21
- data/lib/zucker/camel_snake.rb +15 -0
- data/lib/zucker/constantize.rb +29 -0
- data/lib/zucker/dir_extras.rb +20 -0
- data/lib/zucker/egonil.rb +13 -24
- data/lib/zucker/file_extras.rb +33 -0
- data/lib/zucker/hash_extras.rb +11 -0
- data/lib/zucker/hash_op.rb +28 -0
- data/lib/zucker/instance_variables_from.rb +34 -0
- data/lib/zucker/iterate.rb +24 -21
- data/lib/zucker/marshal_copy.rb +11 -0
- data/lib/zucker/mash.rb +22 -0
- data/lib/zucker/ords.rb +17 -0
- data/lib/zucker/regexp_union.rb +17 -0
- data/lib/zucker/square_brackets_for.rb +12 -15
- data/lib/zucker/string_extras.rb +15 -0
- data/lib/zucker/string_op.rb +20 -0
- data/lib/zucker/tap.rb +13 -8
- data/lib/zucker/unary_conversion.rb +25 -0
- data/spec/alias_for_spec.rb +11 -73
- data/spec/array_op_spec.rb +17 -0
- data/spec/blank_spec.rb +2 -0
- data/spec/camel_snake_spec.rb +15 -0
- data/spec/constantize_spec.rb +33 -0
- data/spec/dir_extras_spec.rb +32 -0
- data/spec/egonil_spec.rb +1 -0
- data/spec/file_extras_spec.rb +57 -0
- data/spec/hash_extras_spec.rb +11 -0
- data/spec/hash_op_spec.rb +28 -0
- data/spec/instance_variables_from_spec.rb +24 -0
- data/spec/iterate_spec.rb +2 -0
- data/spec/{mcopy_spec.rb → marshal_copy_spec.rb} +5 -3
- data/spec/mash_spec.rb +17 -0
- data/spec/ords_spec.rb +15 -0
- data/spec/{union_spec.rb → regexp_union_spec.rb} +4 -2
- data/spec/square_brackets_for_spec.rb +4 -12
- data/spec/string_extras_spec.rb +20 -0
- data/spec/string_op_spec.rb +22 -0
- data/spec/tap_spec.rb +2 -0
- data/spec/{unary_spec.rb → unary_conversion_spec.rb} +4 -2
- data/zucker.gemspec +8 -18
- metadata +75 -147
- data/.gemtest +0 -0
- data/README +0 -7
- data/desc/alias_for.yaml +0 -17
- data/desc/aliases.yaml +0 -18
- data/desc/array.yaml +0 -11
- data/desc/array_to_proc.yaml +0 -16
- data/desc/binding.yaml +0 -22
- data/desc/blank.yaml +0 -11
- data/desc/case.yaml +0 -9
- data/desc/cc.yaml +0 -10
- data/desc/class_to_proc.yaml +0 -11
- data/desc/dd.yaml +0 -23
- data/desc/egonil.yaml +0 -15
- data/desc/engine.yaml +0 -15
- data/desc/enumerable.yaml +0 -10
- data/desc/file.yaml +0 -14
- data/desc/hash.yaml +0 -14
- data/desc/hash_to_proc.yaml +0 -10
- data/desc/info.yaml +0 -20
- data/desc/iterate.yaml +0 -16
- data/desc/ivars.yaml +0 -19
- data/desc/kernel.yaml +0 -15
- data/desc/mcopy.yaml +0 -11
- data/desc/mm.yaml +0 -15
- data/desc/not.yaml +0 -11
- data/desc/oo.yaml +0 -10
- data/desc/os.yaml +0 -19
- data/desc/qq.yaml +0 -11
- data/desc/regexp_to_proc.yaml +0 -12
- data/desc/regexp_visualize.yaml +0 -23
- data/desc/ruby_version.yaml +0 -28
- data/desc/sandbox.yaml +0 -13
- data/desc/square_brackets_for.yaml +0 -22
- data/desc/string.yaml +0 -22
- data/desc/tap.yaml +0 -17
- data/desc/unary.yaml +0 -15
- data/desc/union.yaml +0 -10
- data/doc/zucker_doc.html +0 -3042
- data/lib/zucker/aliases.rb +0 -52
- data/lib/zucker/array.rb +0 -15
- data/lib/zucker/array_to_proc.rb +0 -19
- data/lib/zucker/binding.rb +0 -35
- data/lib/zucker/case.rb +0 -14
- data/lib/zucker/cc.rb +0 -31
- data/lib/zucker/class_to_proc.rb +0 -13
- data/lib/zucker/control.rb +0 -4
- data/lib/zucker/dd.rb +0 -24
- data/lib/zucker/debug.rb +0 -4
- data/lib/zucker/default.rb +0 -4
- data/lib/zucker/engine.rb +0 -70
- data/lib/zucker/enumerable.rb +0 -15
- data/lib/zucker/env.rb +0 -4
- data/lib/zucker/extensions.rb +0 -4
- data/lib/zucker/file.rb +0 -28
- data/lib/zucker/hash.rb +0 -28
- data/lib/zucker/hash_to_proc.rb +0 -17
- data/lib/zucker/info.rb +0 -193
- data/lib/zucker/ivars.rb +0 -29
- data/lib/zucker/kernel.rb +0 -42
- data/lib/zucker/mcopy.rb +0 -11
- data/lib/zucker/mm.rb +0 -41
- data/lib/zucker/not.rb +0 -20
- data/lib/zucker/object.rb +0 -4
- data/lib/zucker/oo.rb +0 -18
- data/lib/zucker/os.rb +0 -55
- data/lib/zucker/qq.rb +0 -13
- data/lib/zucker/regexp_to_proc.rb +0 -13
- data/lib/zucker/regexp_visualize.rb +0 -31
- data/lib/zucker/ruby_version.rb +0 -120
- data/lib/zucker/sandbox.rb +0 -17
- data/lib/zucker/shortcuts.rb +0 -4
- data/lib/zucker/string.rb +0 -55
- data/lib/zucker/to_proc.rb +0 -4
- data/lib/zucker/unary.rb +0 -25
- data/lib/zucker/union.rb +0 -17
- data/spec/aliases_spec.rb +0 -13
- data/spec/array_spec.rb +0 -16
- data/spec/array_to_proc_spec.rb +0 -12
- data/spec/binding_spec.rb +0 -6
- data/spec/case_spec.rb +0 -15
- data/spec/cc_spec.rb +0 -6
- data/spec/class_to_proc_spec.rb +0 -9
- data/spec/dd_spec.rb +0 -37
- data/spec/engine_spec.rb +0 -11
- data/spec/enumerable_spec.rb +0 -8
- data/spec/file_spec.rb +0 -46
- data/spec/hash_spec.rb +0 -25
- data/spec/hash_to_proc_spec.rb +0 -12
- data/spec/info_spec.rb +0 -8
- data/spec/ivars_spec.rb +0 -20
- data/spec/kernel_spec.rb +0 -42
- data/spec/mm_spec.rb +0 -6
- data/spec/not_spec.rb +0 -10
- data/spec/oo_spec.rb +0 -6
- data/spec/os_spec.rb +0 -37
- data/spec/qq_spec.rb +0 -19
- data/spec/regexp_to_proc_spec.rb +0 -9
- data/spec/regexp_visualize_spec.rb +0 -38
- data/spec/ruby_version_spec.rb +0 -55
- data/spec/sandbox_spec.rb +0 -14
- data/spec/string_spec.rb +0 -65
data/.gemtest
DELETED
File without changes
|
data/README
DELETED
data/desc/alias_for.yaml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
alias_for:
|
2
|
-
summary: 'A different way to create aliases: Reversed order and you can pass multiple alias names.'
|
3
|
-
why: "It's clearer in which order to put the arguments."
|
4
|
-
methods:
|
5
|
-
alias_for, aliases_for: |
|
6
|
-
alias_for :methods, :ms # creates an alias for the method :methods with the name ms
|
7
|
-
module Enumerable
|
8
|
-
aliases_for :zip, :with, :%
|
9
|
-
end # creates multiple aliases
|
10
|
-
Module#method_alias_for, Module#method_aliases_for: |
|
11
|
-
# same as alias_for, but using Module#alias_method instead of alias
|
12
|
-
info:
|
13
|
-
- Thanks to Kristian Mandrup for the idea and alias method specs.
|
14
|
-
versions:
|
15
|
-
- 1.9
|
16
|
-
- 1.8
|
17
|
-
|
data/desc/aliases.yaml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
aliases:
|
2
|
-
summary: Some convenient aliases (and constants) for existing methods.
|
3
|
-
methods:
|
4
|
-
Object#is_an?: Object.is_a?
|
5
|
-
Enumerable#with: Enumerable#zip
|
6
|
-
Enumerable#%: Enumerable#zip
|
7
|
-
Array#**: Array#product
|
8
|
-
Hash#+: Hash#merge
|
9
|
-
Binding#[]: Binding#eval
|
10
|
-
File.filename: File.basename
|
11
|
-
Dir.join: File.join
|
12
|
-
Dir.split: File.split
|
13
|
-
Infinity: 1.0 / 0.0
|
14
|
-
NaN: 0.0 / 0.0
|
15
|
-
versions:
|
16
|
-
- 1.9
|
17
|
-
- 1.8
|
18
|
-
|
data/desc/array.yaml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
array:
|
2
|
-
summary: Methods one could miss for ⇧Array⇧.
|
3
|
-
why:
|
4
|
-
- ⇧Array⇧ has ⇧&⇧ and ⇧|⇧, but why does it not have ⇧^⇧?
|
5
|
-
methods:
|
6
|
-
Array#^: "[1,2,3,4] ^ [3,4,5,6] # => [1,2,5,6]"
|
7
|
-
Array#chrs: "[72, 97, 108, 108, 111].chrs # => 'Hallo'"
|
8
|
-
versions:
|
9
|
-
- 1.9
|
10
|
-
- 1.8
|
11
|
-
|
data/desc/array_to_proc.yaml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
array_to_proc:
|
2
|
-
summary: Calls the method named by the first paramenter and passes the other elements as paramaters.
|
3
|
-
why: When using ⇧Symbol#to_proc⇧, you often wish to pass parameters.
|
4
|
-
methods:
|
5
|
-
Array#to_proc: |
|
6
|
-
[1,2,3,4].map &[:*, 5] # => [5, 10, 15, 20]
|
7
|
-
# you can also chain them, if the first parameter is an Array
|
8
|
-
[1,2,3,4].map &[[:to_s, 2],[:+, 'b']] # => ["1b", "10b", "11b", "100b"]
|
9
|
-
info:
|
10
|
-
- Inspired by →this article→http://www.sanityinc.com/articles/adding-array-to-proc-to-ruby→.
|
11
|
-
- "More about →to_proc→http://rbjl.net/29-become-a-proc-star→."
|
12
|
-
- Chaining inspired by →eregon→http://github.com/eregon/Classes/blob/master/to_proc.rb→.
|
13
|
-
versions:
|
14
|
-
- 1.9
|
15
|
-
- 1.8
|
16
|
-
|
data/desc/binding.yaml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
binding:
|
2
|
-
summary: Adds ⇧Binding#vars⇧. It gives you information about the current environment variables.
|
3
|
-
methods:
|
4
|
-
Binding#variables, Binding#vars: |
|
5
|
-
# shows your current environment's variables, irb example:
|
6
|
-
>> a=3
|
7
|
-
=> 3
|
8
|
-
>> binding.vars
|
9
|
-
=> #<Binding:0x94c4b50>
|
10
|
-
local variables
|
11
|
-
- a: 3
|
12
|
-
- _: #<Binding:0x94c4b50>
|
13
|
-
(instance variables)
|
14
|
-
- none
|
15
|
-
self
|
16
|
-
- main
|
17
|
-
block_given?
|
18
|
-
- false
|
19
|
-
versions:
|
20
|
-
- 1.9
|
21
|
-
- 1.8 (no rbx support)
|
22
|
-
|
data/desc/blank.yaml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
blank:
|
2
|
-
summary: Does pretty the same as in ActiveSupport (Every object can be asked if it is blank or present).
|
3
|
-
why: It's too familiar ;)
|
4
|
-
methods:
|
5
|
-
Object#blank?:
|
6
|
-
- "'an object'.blank? # => false"
|
7
|
-
- "nil.present? # => false"
|
8
|
-
versions:
|
9
|
-
- 1.9
|
10
|
-
- 1.8
|
11
|
-
|
data/desc/case.yaml
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
case:
|
2
|
-
summary: Provides ⇧String#to_camel⇧ and ⇧String#to_snake⇧.
|
3
|
-
why: It kind of lies in the nature of Ruby.
|
4
|
-
methods:
|
5
|
-
String#to_camel: "'was_snake_string'.to_camel # => 'WasSnakeString'"
|
6
|
-
String#to_snake: "'WasCamelString' # => 'was_camel_string'"
|
7
|
-
versions:
|
8
|
-
- 1.9
|
9
|
-
|
data/desc/cc.yaml
DELETED
data/desc/class_to_proc.yaml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
class_to_proc:
|
2
|
-
summary: Creates a new instance of the class.
|
3
|
-
methods:
|
4
|
-
Class#to_proc: "[ [1,2],[3,5,6,7,3] ].map(&Set) # => [ Set[1,2], Set[5,6,7,3] ]"
|
5
|
-
info:
|
6
|
-
- Inspired by Ruby Facets.
|
7
|
-
- "More about →to_proc→http://rbjl.net/29-become-a-proc-star→."
|
8
|
-
versions:
|
9
|
-
- 1.9
|
10
|
-
- 1.8
|
11
|
-
|
data/desc/dd.yaml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
dd:
|
2
|
-
summary: Easy debug printing with the ⇧p⇧ alternative ⇧.d⇧. It outputs to stdout and returns ⇧self⇧. Accepts a block.
|
3
|
-
methods:
|
4
|
-
Object#d, Object#dd: |
|
5
|
-
some.d.methods.d.noone.d.knows.d
|
6
|
-
# ...outputs 4 lines with the inspected objects
|
7
|
-
# => (result)
|
8
|
-
|
9
|
-
21+Math.sin(42).d
|
10
|
-
# outputs -0.916521547915634
|
11
|
-
# => 20.0834784520844
|
12
|
-
|
13
|
-
name = 'Earth'
|
14
|
-
'Hello ' + name.d{|e| "The length is: #{e.size}"}
|
15
|
-
# outputs "The length is: 5"
|
16
|
-
# => 'Hello Earth'
|
17
|
-
info:
|
18
|
-
- "This is inspired by the →⇧.tap⇧ method→http://moonbase.rydia.net/mental/blog/programming/eavesdropping-on-expressions→."
|
19
|
-
- There is also ⇧tap⇧ cube with more ⇧tap⇧ methods.
|
20
|
-
versions:
|
21
|
-
- 1.9
|
22
|
-
- 1.8
|
23
|
-
|
data/desc/egonil.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
egonil:
|
2
|
-
summary: Creates a block, where ⇧nil⇧ does not raise ⇧NoMethodError⇧s.
|
3
|
-
methods:
|
4
|
-
egonil, nn: |
|
5
|
-
egonil do
|
6
|
-
nil.some_methods.that[:do].not.exist
|
7
|
-
end # => nil
|
8
|
-
|
9
|
-
nn{ nil.some_methods.that[:do].not.exist } # => nil
|
10
|
-
info:
|
11
|
-
- See →this post→http://rbjl.net/26-the-28-bytes-of-ruby-joy→ for more information and discussion.
|
12
|
-
versions:
|
13
|
-
- 1.9
|
14
|
-
- 1.8
|
15
|
-
|
data/desc/engine.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
engine:
|
2
|
-
summary: Adds a ⇧RubyEngine⇧ class for easy compatibility checks.
|
3
|
-
methods:
|
4
|
-
RubyEngine: |
|
5
|
-
RubyEngine: "# outputs the interpreter name"
|
6
|
-
RubyEngine.mri?: "RubyEngine.mri? # true if using the official Ruby interpreter"
|
7
|
-
RubyEngine.jruby?: "RubyEngine.jruby? # true if using JRuby"
|
8
|
-
RubyEngine.rubinius?: "RubyEngine.rubinius? # true if using rubinius"
|
9
|
-
RubyEngine.ree?: "RubyEngine.ree? # true if using enterprise edition"
|
10
|
-
RubyEngine.ironruby?: "RubyEngine.ironruby? # true if using IronRuby"
|
11
|
-
RubyEngine.macruby?: "RubyEngine.macruby? # true if using MacRuby"
|
12
|
-
RubyEngine.cardinal?: "RubyEngine.cardinal? # true if using parrot"
|
13
|
-
versions:
|
14
|
-
- 1.9
|
15
|
-
- 1.8
|
data/desc/enumerable.yaml
DELETED
data/desc/file.yaml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
file:
|
2
|
-
summary: Extensions for ⇧File⇧.
|
3
|
-
methods:
|
4
|
-
File.gsub: |
|
5
|
-
File.gsub 'some_filename', # will read the file and substitute the hash keys with their values
|
6
|
-
/hi/ => 'cu',
|
7
|
-
/\d/ => proc{ |m| (m.to_i+1).to_s }
|
8
|
-
File.delete!: "File.delete! 'some_filename' # will delete the file, don't care if it exist."
|
9
|
-
info:
|
10
|
-
- "Idea for ⇧File.delete!⇧ from sugar-high."
|
11
|
-
versions:
|
12
|
-
- 1.9
|
13
|
-
- 1.8
|
14
|
-
|
data/desc/hash.yaml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
hash:
|
2
|
-
summary: Some sugar for dealing with hashes.
|
3
|
-
methods:
|
4
|
-
Hash.zip: "Hash.zip [1,2,3], [4,5,6] # => {1=>4, 2=>5, 3=>6}"
|
5
|
-
Hash#<<: |
|
6
|
-
{1=>2} << [3, 4] # => { 1=>2, 3=>4 }
|
7
|
-
{1=>2} << { 5=>6 } # => { 1=>2, 5=>6 }
|
8
|
-
Hash#&: "{ 1=>4, 2=>5, 3=>6 } & { 1=>4, 2=>7 } # => { 1=>4 }"
|
9
|
-
info:
|
10
|
-
- Some of the operators are inspired by Ruby Facets.
|
11
|
-
versions:
|
12
|
-
- 1.9
|
13
|
-
- 1.8
|
14
|
-
|
data/desc/hash_to_proc.yaml
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
hash_to_proc:
|
2
|
-
summary: Use a hash to apply procs to specific objects.
|
3
|
-
methods:
|
4
|
-
Hash#to_proc: "[1,2,3,4].map(&{\n2 => lambda {|e| e + 1000},\n4 => :to_s,\n}) # => [1, 1002, 3, '4']"
|
5
|
-
info:
|
6
|
-
- "More about →to_proc→http://rbjl.net/29-become-a-proc-star→."
|
7
|
-
versions:
|
8
|
-
- 1.9
|
9
|
-
- 1.8
|
10
|
-
|
data/desc/info.yaml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
info:
|
2
|
-
summary: Access environment information with the ⇧Info⇧ module.
|
3
|
-
why: "You don't need to remember in which global variable, constant or special method the information you are searching for is hidden."
|
4
|
-
methods:
|
5
|
-
Info: |
|
6
|
-
# for example
|
7
|
-
Info.working_directory # Dir.pwd
|
8
|
-
Info.load_path # $:
|
9
|
-
Info.platform # RUBY_PLATFORM
|
10
|
-
Info.current_file # similar to __FILE__
|
11
|
-
# you could also add them to the global namespace with: include Info
|
12
|
-
# see the source file for the list of accessors or
|
13
|
-
Info.list
|
14
|
-
info:
|
15
|
-
- Please note that it is not possible to put some of __THOSE_KEYWORDS__ in methods, so the result might slightly differ. This might affect ⇧current_file⇧, ⇧current_file_directory⇧, ⇧current_line⇧ and ⇧current_method⇧.
|
16
|
-
- Thanks to Facets for the ⇧caller⇧ Regexp.
|
17
|
-
versions:
|
18
|
-
- 1.9
|
19
|
-
- 1.8 (not all information)
|
20
|
-
|
data/desc/iterate.yaml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
iterate:
|
2
|
-
summary: Iterate over one or more collections.
|
3
|
-
why: "It's like ⇧.each⇧ with two differences: It feels more like a control structure and you can easily iterate over multiple objects."
|
4
|
-
methods:
|
5
|
-
iterate: |
|
6
|
-
iterate [1,2], [3,4,5] do |e,f|
|
7
|
-
puts "#{e},#{f}"
|
8
|
-
end
|
9
|
-
# outputs
|
10
|
-
# 1,3
|
11
|
-
# 2,4
|
12
|
-
# ,5
|
13
|
-
versions:
|
14
|
-
- 1.9
|
15
|
-
- 1.8
|
16
|
-
|
data/desc/ivars.yaml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
ivars:
|
2
|
-
summary: This method lets you easily assign lots of instance variables.
|
3
|
-
why: |
|
4
|
-
Often, you have to write boilerplate code for assigning instance variables, for example this one:
|
5
|
-
⇧def initialize(variable1, variable2)
|
6
|
-
@variable1, @variable2 = variable1, variable2
|
7
|
-
end⇧
|
8
|
-
methods:
|
9
|
-
instance_variables_from, ivars: |
|
10
|
-
def a_method(a = 1, b = 2)
|
11
|
-
instance_variables_from binding # assigns @a and @b
|
12
|
-
|
13
|
-
params = {:c => 3, :d => 4}
|
14
|
-
instance_variables_from params # # assigns @c and @d
|
15
|
-
end
|
16
|
-
versions:
|
17
|
-
- 1.9
|
18
|
-
- 1.8
|
19
|
-
|
data/desc/kernel.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
kernel:
|
2
|
-
summary: Some useful general shortcut methods.
|
3
|
-
why: Readability.
|
4
|
-
methods:
|
5
|
-
activate_warnings!: "activate_warnings! # sets $VERBOSE to 1"
|
6
|
-
deactivate_warnings!: "deactivate_warnings! # sets $VERBOSE to 0"
|
7
|
-
executed_directly?, directly_executed?, standalone?: "executed_directly? # checks, if the current file is run directly -> true"
|
8
|
-
library?: "library? # checks, if the current file is run directly -> false"
|
9
|
-
irb?: "irb? # returns false if not called from IRB or RIPL"
|
10
|
-
ignore_sigint!: "ignore_sigint! # blocks CTRL+C"
|
11
|
-
ignore_sigquit!: "ignore_sigquit! # blocks CTRL+\\"
|
12
|
-
versions:
|
13
|
-
- 1.9
|
14
|
-
- 1.8
|
15
|
-
|
data/desc/mcopy.yaml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
mcopy:
|
2
|
-
summary: Adds ⇧Object#mcopy⇧ to create a deep copy using ⇧Marshal⇧.
|
3
|
-
why: Every Ruby book describes, you can do ⇧Marshal.load Marshal.dump object⇧ to create a deep copy... But who needs this verbose syntax in everyday coding?
|
4
|
-
methods:
|
5
|
-
Object#mcopy: |
|
6
|
-
a = %w[hello world]
|
7
|
-
b = a.mcopy
|
8
|
-
versions:
|
9
|
-
- 1.9
|
10
|
-
- 1.8
|
11
|
-
|
data/desc/mm.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
mm:
|
2
|
-
summary: ⇧m⇧ displays an ordered public method list.
|
3
|
-
why: See one object's methods without those rarely used inherited methods.
|
4
|
-
methods:
|
5
|
-
Object#m, Object#mm, Object#method_list: |
|
6
|
-
>> 5.mm 2 # outputs the list (2 levels deep), for example:
|
7
|
-
# = Fixnum
|
8
|
-
# to_s -@ + - * / div % modulo divmod fdiv ** abs magnitude == === <=> > >= < <= ~ & | ^ [] << >> to_f size zero? odd? even? succ
|
9
|
-
# = Integer
|
10
|
-
# integer? odd? even? upto downto times succ next pred chr ord to_i to_int floor ceil truncate round gcd lcm gcdlcm numerator denominator to_r rationalize
|
11
|
-
info:
|
12
|
-
- See →this article→http://rbjl.net/31-the-multi-mega-method-list→ for more information.
|
13
|
-
versions:
|
14
|
-
- 1.9
|
15
|
-
- 1.8
|
data/desc/not.yaml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
not:
|
2
|
-
summary: ⇧not⇧ returns an object on which all methods are redirected to it's receiver object, but returns the inverted boolean.
|
3
|
-
why: Better readability.
|
4
|
-
methods:
|
5
|
-
Object#not: |
|
6
|
-
[1,2,3].not.empty? # true
|
7
|
-
info:
|
8
|
-
- See →this article by Jay Field→http://blog.jayfields.com/2007/08/ruby-adding-not-method-for-readability.html→ for more information.
|
9
|
-
versions:
|
10
|
-
- 1.9
|
11
|
-
|
data/desc/oo.yaml
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
oo:
|
2
|
-
summary: The ⇧o⇧ method outputs the current method, line, file and label (if given).
|
3
|
-
methods:
|
4
|
-
o, oo: |
|
5
|
-
o # e.g: Reached method `irb_binding', line 1 of file (irb)
|
6
|
-
o:Label # e.g: Label: reached method `abc', line 7 of file (irb)
|
7
|
-
versions:
|
8
|
-
- 1.9
|
9
|
-
- 1.8
|
10
|
-
|
data/desc/os.yaml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
os:
|
2
|
-
summary: Detect the operating system.
|
3
|
-
why: Checking for ⇧RUBY_PLATFORM⇧ does not report the OS when using JRuby and for better readability.
|
4
|
-
methods:
|
5
|
-
OS: "# displays the operating system"
|
6
|
-
OS.linux?: "OS.linux? # true if you are on a linux machine"
|
7
|
-
OS.mac?: "OS.mac? # true for macs"
|
8
|
-
OS.bsd?: "OS.bsd? # true for bsds"
|
9
|
-
OS.windows?: "include OS; windows? # true for windows. Example of including OS to get the os methods into the global namespace"
|
10
|
-
OS.solaris?: "OS.solaris? # true for solaris/sunos"
|
11
|
-
OS.posix?: "OS.posix? # true if system is posix compatible"
|
12
|
-
OS.is?: "OS.is? /x/ # matches the regex against the os string"
|
13
|
-
info:
|
14
|
-
- This cube depends on system information and may not be 100% accurate.
|
15
|
-
- "Syntax and semantic inspired by Roger Pack's →os gem→http://github.com/rdp/os→."
|
16
|
-
versions:
|
17
|
-
- 1.9
|
18
|
-
- 1.8
|
19
|
-
|
data/desc/qq.yaml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
qq:
|
2
|
-
summary: The ⇧q⇧ method does the same like ⇧p⇧, but outputs multiple arguments on the same line.
|
3
|
-
methods:
|
4
|
-
q, qq: |
|
5
|
-
q "zucker", '', {6=>7}, 5, 2.3, :o # outputs "zucker" "" {6=>7} 5 2.3 :o
|
6
|
-
info:
|
7
|
-
- Inspired by →rdp→http://github.com/rdp/sane/blob/master/lib/sane/pps.rb→.
|
8
|
-
versions:
|
9
|
-
- 1.9
|
10
|
-
- 1.8
|
11
|
-
|
data/desc/regexp_to_proc.yaml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
regexp_to_proc:
|
2
|
-
summary: Use ⇧&/regex/⇧ to match it against strings.
|
3
|
-
methods:
|
4
|
-
Regexp#to_proc: |
|
5
|
-
%w|just another string array|.map &/[jy]/ # => ["j", nil, nil, "y"]
|
6
|
-
%w|just another string array|.select &/[jy]/ # => ["just", "array"]
|
7
|
-
info:
|
8
|
-
- "More about →to_proc→http://rbjl.net/29-become-a-proc-star→."
|
9
|
-
versions:
|
10
|
-
- 1.9
|
11
|
-
- 1.8
|
12
|
-
|