zucker 8 → 9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +14 -0
- data/MIT-LICENSE +1 -1
- data/README +1 -1
- data/Rakefile +33 -40
- data/desc/alias_for.yaml +17 -0
- data/desc/aliases.yaml +18 -0
- data/desc/array.yaml +13 -0
- data/desc/array_to_proc.yaml +16 -0
- data/desc/binding.yaml +22 -0
- data/desc/blank.yaml +9 -0
- data/desc/cc.yaml +10 -0
- data/desc/class_to_proc.yaml +11 -0
- data/desc/dd.yaml +23 -0
- data/desc/egonil.yaml +15 -0
- data/desc/engine.yaml +15 -0
- data/desc/enumerable.yaml +10 -0
- data/desc/file.yaml +15 -0
- data/desc/hash.yaml +14 -0
- data/desc/hash_to_proc.yaml +10 -0
- data/desc/info.yaml +20 -0
- data/desc/iterate.yaml +16 -0
- data/desc/ivars.yaml +19 -0
- data/desc/kernel.yaml +14 -0
- data/desc/mcopy.yaml +11 -0
- data/desc/mm.yaml +15 -0
- data/desc/not.yaml +11 -0
- data/desc/oo.yaml +10 -0
- data/desc/os.yaml +19 -0
- data/desc/qq.yaml +11 -0
- data/desc/regexp_to_proc.yaml +12 -0
- data/desc/regexp_visualize.yaml +23 -0
- data/desc/sandbox.yaml +12 -0
- data/desc/square_brackets_for.yaml +22 -0
- data/desc/string.yaml +23 -0
- data/desc/tap.yaml +17 -0
- data/desc/unary.yaml +15 -0
- data/desc/union.yaml +10 -0
- data/desc/version.yaml +28 -0
- data/doc/zucker_doc.html +2688 -0
- data/doc/zucker_doc.rb +553 -0
- data/lib/zucker.rb +10 -9
- data/lib/zucker/array2proc.rb +2 -18
- data/lib/zucker/{2/array2proc.rb → array_to_proc.rb} +0 -0
- data/lib/zucker/binding.rb +4 -5
- data/lib/zucker/cc.rb +7 -2
- data/lib/zucker/class2proc.rb +2 -12
- data/lib/zucker/{1/class2proc.rb → class_to_proc.rb} +0 -0
- data/lib/zucker/file.rb +22 -0
- data/lib/zucker/hash2proc.rb +2 -16
- data/lib/zucker/{1/hash2proc.rb → hash_to_proc.rb} +0 -0
- data/lib/zucker/kernel.rb +4 -2
- data/lib/zucker/mm.rb +14 -8
- data/lib/zucker/regexp2proc.rb +2 -12
- data/lib/zucker/{1/regexp2proc.rb → regexp_to_proc.rb} +0 -0
- data/lib/zucker/regexp_visualize.rb +26 -0
- data/lib/zucker/sandbox.rb +1 -11
- data/spec/alias_for_spec.rb +117 -0
- data/spec/aliases_spec.rb +13 -0
- data/spec/array_spec.rb +23 -0
- data/spec/array_to_proc_spec.rb +12 -0
- data/spec/binding_spec.rb +6 -0
- data/spec/blank_spec.rb +20 -0
- data/spec/cc_spec.rb +6 -0
- data/spec/class_to_proc_spec.rb +9 -0
- data/spec/dd_spec.rb +37 -0
- data/spec/egonil_spec.rb +32 -0
- data/spec/engine_spec.rb +11 -0
- data/spec/enumerable_spec.rb +8 -0
- data/spec/file_spec.rb +30 -0
- data/spec/hash_spec.rb +25 -0
- data/spec/hash_to_proc_spec.rb +12 -0
- data/spec/info_spec.rb +8 -0
- data/spec/iterate_spec.rb +59 -0
- data/spec/ivars_spec.rb +20 -0
- data/spec/kernel_spec.rb +37 -0
- data/spec/mcopy_spec.rb +13 -0
- data/spec/mm_spec.rb +6 -0
- data/spec/not_spec.rb +12 -0
- data/spec/oo_spec.rb +6 -0
- data/spec/os_spec.rb +37 -0
- data/spec/qq_spec.rb +19 -0
- data/spec/regexp_to_proc_spec.rb +9 -0
- data/spec/regexp_visualize_spec.rb +38 -0
- data/spec/sandbox_spec.rb +12 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/square_brackets_for_spec.rb +59 -0
- data/spec/string_spec.rb +65 -0
- data/spec/tap_spec.rb +18 -0
- data/spec/unary_spec.rb +26 -0
- data/spec/union_spec.rb +17 -0
- data/spec/version_spec.rb +55 -0
- data/zucker.gemspec +21 -0
- metadata +139 -323
- data/lib/zucker/1/D.rb +0 -21
- data/lib/zucker/1/aliases.rb +0 -30
- data/lib/zucker/1/all.rb +0 -8
- data/lib/zucker/1/array.rb +0 -19
- data/lib/zucker/1/array2proc.rb +0 -12
- data/lib/zucker/1/binding.rb +0 -27
- data/lib/zucker/1/blank.rb +0 -28
- data/lib/zucker/1/debug.rb +0 -6
- data/lib/zucker/1/default.rb +0 -27
- data/lib/zucker/1/egonil.rb +0 -16
- data/lib/zucker/1/enumerable.rb +0 -14
- data/lib/zucker/1/hash.rb +0 -21
- data/lib/zucker/1/iterate.rb +0 -25
- data/lib/zucker/1/ivars.rb +0 -28
- data/lib/zucker/1/kernel.rb +0 -22
- data/lib/zucker/1/mcopy.rb +0 -11
- data/lib/zucker/1/mm.rb +0 -33
- data/lib/zucker/1/sandbox.rb +0 -17
- data/lib/zucker/1/square_brackets_for.rb +0 -22
- data/lib/zucker/1/string.rb +0 -27
- data/lib/zucker/1/unary.rb +0 -24
- data/lib/zucker/1/union.rb +0 -16
- data/lib/zucker/2/D.rb +0 -21
- data/lib/zucker/2/aliases.rb +0 -30
- data/lib/zucker/2/all.rb +0 -8
- data/lib/zucker/2/array.rb +0 -19
- data/lib/zucker/2/binding.rb +0 -27
- data/lib/zucker/2/blank.rb +0 -28
- data/lib/zucker/2/class2proc.rb +0 -12
- data/lib/zucker/2/debug.rb +0 -6
- data/lib/zucker/2/default.rb +0 -27
- data/lib/zucker/2/egonil.rb +0 -16
- data/lib/zucker/2/enumerable.rb +0 -14
- data/lib/zucker/2/hash.rb +0 -21
- data/lib/zucker/2/hash2proc.rb +0 -16
- data/lib/zucker/2/info.rb +0 -166
- data/lib/zucker/2/iterate.rb +0 -25
- data/lib/zucker/2/ivars.rb +0 -28
- data/lib/zucker/2/kernel.rb +0 -20
- data/lib/zucker/2/mcopy.rb +0 -11
- data/lib/zucker/2/mm.rb +0 -33
- data/lib/zucker/2/regexp2proc.rb +0 -12
- data/lib/zucker/2/sandbox.rb +0 -21
- data/lib/zucker/2/square_brackets_for.rb +0 -22
- data/lib/zucker/2/string.rb +0 -27
- data/lib/zucker/2/unary.rb +0 -24
- data/lib/zucker/2/union.rb +0 -16
- data/lib/zucker/3/D.rb +0 -21
- data/lib/zucker/3/alias_for.rb +0 -21
- data/lib/zucker/3/aliases.rb +0 -30
- data/lib/zucker/3/all.rb +0 -8
- data/lib/zucker/3/array.rb +0 -25
- data/lib/zucker/3/array2proc.rb +0 -18
- data/lib/zucker/3/binding.rb +0 -27
- data/lib/zucker/3/blank.rb +0 -28
- data/lib/zucker/3/class2proc.rb +0 -12
- data/lib/zucker/3/debug.rb +0 -8
- data/lib/zucker/3/default.rb +0 -37
- data/lib/zucker/3/egonil.rb +0 -16
- data/lib/zucker/3/enumerable.rb +0 -14
- data/lib/zucker/3/hash.rb +0 -21
- data/lib/zucker/3/hash2proc.rb +0 -16
- data/lib/zucker/3/info.rb +0 -169
- data/lib/zucker/3/iterate.rb +0 -25
- data/lib/zucker/3/ivars.rb +0 -28
- data/lib/zucker/3/kernel.rb +0 -50
- data/lib/zucker/3/mcopy.rb +0 -10
- data/lib/zucker/3/mm.rb +0 -33
- data/lib/zucker/3/not.rb +0 -19
- data/lib/zucker/3/regexp2proc.rb +0 -12
- data/lib/zucker/3/sandbox.rb +0 -21
- data/lib/zucker/3/square_brackets_for.rb +0 -22
- data/lib/zucker/3/string.rb +0 -49
- data/lib/zucker/3/tap.rb +0 -11
- data/lib/zucker/3/unary.rb +0 -24
- data/lib/zucker/3/union.rb +0 -16
- data/lib/zucker/4/D.rb +0 -21
- data/lib/zucker/4/alias_for.rb +0 -21
- data/lib/zucker/4/aliases.rb +0 -35
- data/lib/zucker/4/all.rb +0 -8
- data/lib/zucker/4/array.rb +0 -25
- data/lib/zucker/4/array2proc.rb +0 -18
- data/lib/zucker/4/binding.rb +0 -27
- data/lib/zucker/4/blank.rb +0 -28
- data/lib/zucker/4/class2proc.rb +0 -12
- data/lib/zucker/4/debug.rb +0 -8
- data/lib/zucker/4/default.rb +0 -40
- data/lib/zucker/4/egonil.rb +0 -16
- data/lib/zucker/4/engine.rb +0 -69
- data/lib/zucker/4/enumerable.rb +0 -14
- data/lib/zucker/4/hash.rb +0 -21
- data/lib/zucker/4/hash2proc.rb +0 -16
- data/lib/zucker/4/info.rb +0 -173
- data/lib/zucker/4/iterate.rb +0 -25
- data/lib/zucker/4/ivars.rb +0 -28
- data/lib/zucker/4/kernel.rb +0 -27
- data/lib/zucker/4/mcopy.rb +0 -10
- data/lib/zucker/4/mm.rb +0 -33
- data/lib/zucker/4/not.rb +0 -19
- data/lib/zucker/4/os.rb +0 -50
- data/lib/zucker/4/q.rb +0 -7
- data/lib/zucker/4/regexp2proc.rb +0 -12
- data/lib/zucker/4/sandbox.rb +0 -23
- data/lib/zucker/4/square_brackets_for.rb +0 -22
- data/lib/zucker/4/string.rb +0 -54
- data/lib/zucker/4/tap.rb +0 -11
- data/lib/zucker/4/unary.rb +0 -24
- data/lib/zucker/4/union.rb +0 -16
- data/lib/zucker/4/version.rb +0 -115
- data/lib/zucker/5/alias_for.rb +0 -21
- data/lib/zucker/5/aliases.rb +0 -51
- data/lib/zucker/5/all.rb +0 -4
- data/lib/zucker/5/array.rb +0 -25
- data/lib/zucker/5/array2proc.rb +0 -18
- data/lib/zucker/5/binding.rb +0 -34
- data/lib/zucker/5/blank.rb +0 -28
- data/lib/zucker/5/cc.rb +0 -25
- data/lib/zucker/5/class2proc.rb +0 -12
- data/lib/zucker/5/control.rb +0 -4
- data/lib/zucker/5/dd.rb +0 -24
- data/lib/zucker/5/debug.rb +0 -4
- data/lib/zucker/5/default.rb +0 -4
- data/lib/zucker/5/egonil.rb +0 -16
- data/lib/zucker/5/engine.rb +0 -69
- data/lib/zucker/5/enumerable.rb +0 -14
- data/lib/zucker/5/env.rb +0 -4
- data/lib/zucker/5/extensions.rb +0 -4
- data/lib/zucker/5/hash.rb +0 -27
- data/lib/zucker/5/hash2proc.rb +0 -16
- data/lib/zucker/5/info.rb +0 -177
- data/lib/zucker/5/iterate.rb +0 -26
- data/lib/zucker/5/ivars.rb +0 -28
- data/lib/zucker/5/kernel.rb +0 -34
- data/lib/zucker/5/mcopy.rb +0 -10
- data/lib/zucker/5/mm.rb +0 -34
- data/lib/zucker/5/not.rb +0 -19
- data/lib/zucker/5/object.rb +0 -4
- data/lib/zucker/5/oo.rb +0 -17
- data/lib/zucker/5/os.rb +0 -49
- data/lib/zucker/5/qq.rb +0 -12
- data/lib/zucker/5/regexp2proc.rb +0 -12
- data/lib/zucker/5/sandbox.rb +0 -25
- data/lib/zucker/5/shortcuts.rb +0 -4
- data/lib/zucker/5/square_brackets_for.rb +0 -21
- data/lib/zucker/5/string.rb +0 -54
- data/lib/zucker/5/tap.rb +0 -11
- data/lib/zucker/5/to_proc.rb +0 -4
- data/lib/zucker/5/unary.rb +0 -24
- data/lib/zucker/5/union.rb +0 -16
- data/lib/zucker/5/version.rb +0 -118
- data/lib/zucker/6/alias_for.rb +0 -21
- data/lib/zucker/6/aliases.rb +0 -51
- data/lib/zucker/6/all.rb +0 -4
- data/lib/zucker/6/array.rb +0 -25
- data/lib/zucker/6/array2proc.rb +0 -18
- data/lib/zucker/6/binding.rb +0 -34
- data/lib/zucker/6/blank.rb +0 -28
- data/lib/zucker/6/cc.rb +0 -25
- data/lib/zucker/6/class2proc.rb +0 -12
- data/lib/zucker/6/control.rb +0 -4
- data/lib/zucker/6/dd.rb +0 -23
- data/lib/zucker/6/debug.rb +0 -4
- data/lib/zucker/6/default.rb +0 -4
- data/lib/zucker/6/egonil.rb +0 -27
- data/lib/zucker/6/engine.rb +0 -68
- data/lib/zucker/6/enumerable.rb +0 -14
- data/lib/zucker/6/env.rb +0 -4
- data/lib/zucker/6/extensions.rb +0 -4
- data/lib/zucker/6/hash.rb +0 -27
- data/lib/zucker/6/hash2proc.rb +0 -16
- data/lib/zucker/6/info.rb +0 -192
- data/lib/zucker/6/iterate.rb +0 -27
- data/lib/zucker/6/ivars.rb +0 -28
- data/lib/zucker/6/kernel.rb +0 -34
- data/lib/zucker/6/mcopy.rb +0 -10
- data/lib/zucker/6/mm.rb +0 -34
- data/lib/zucker/6/not.rb +0 -19
- data/lib/zucker/6/object.rb +0 -4
- data/lib/zucker/6/oo.rb +0 -17
- data/lib/zucker/6/os.rb +0 -54
- data/lib/zucker/6/qq.rb +0 -12
- data/lib/zucker/6/regexp2proc.rb +0 -12
- data/lib/zucker/6/sandbox.rb +0 -25
- data/lib/zucker/6/shortcuts.rb +0 -4
- data/lib/zucker/6/square_brackets_for.rb +0 -21
- data/lib/zucker/6/string.rb +0 -54
- data/lib/zucker/6/tap.rb +0 -11
- data/lib/zucker/6/to_proc.rb +0 -4
- data/lib/zucker/6/unary.rb +0 -24
- data/lib/zucker/6/union.rb +0 -16
- data/lib/zucker/6/version.rb +0 -118
- data/lib/zucker/7/alias_for.rb +0 -21
- data/lib/zucker/7/aliases.rb +0 -51
- data/lib/zucker/7/all.rb +0 -4
- data/lib/zucker/7/array.rb +0 -25
- data/lib/zucker/7/array2proc.rb +0 -18
- data/lib/zucker/7/binding.rb +0 -34
- data/lib/zucker/7/blank.rb +0 -28
- data/lib/zucker/7/cc.rb +0 -25
- data/lib/zucker/7/class2proc.rb +0 -12
- data/lib/zucker/7/control.rb +0 -4
- data/lib/zucker/7/dd.rb +0 -23
- data/lib/zucker/7/debug.rb +0 -4
- data/lib/zucker/7/default.rb +0 -4
- data/lib/zucker/7/egonil.rb +0 -27
- data/lib/zucker/7/engine.rb +0 -68
- data/lib/zucker/7/enumerable.rb +0 -14
- data/lib/zucker/7/env.rb +0 -4
- data/lib/zucker/7/extensions.rb +0 -4
- data/lib/zucker/7/hash.rb +0 -27
- data/lib/zucker/7/hash2proc.rb +0 -16
- data/lib/zucker/7/info.rb +0 -192
- data/lib/zucker/7/iterate.rb +0 -27
- data/lib/zucker/7/ivars.rb +0 -28
- data/lib/zucker/7/kernel.rb +0 -34
- data/lib/zucker/7/mcopy.rb +0 -10
- data/lib/zucker/7/mm.rb +0 -34
- data/lib/zucker/7/not.rb +0 -19
- data/lib/zucker/7/object.rb +0 -4
- data/lib/zucker/7/oo.rb +0 -17
- data/lib/zucker/7/os.rb +0 -54
- data/lib/zucker/7/qq.rb +0 -12
- data/lib/zucker/7/regexp2proc.rb +0 -12
- data/lib/zucker/7/sandbox.rb +0 -25
- data/lib/zucker/7/shortcuts.rb +0 -4
- data/lib/zucker/7/square_brackets_for.rb +0 -21
- data/lib/zucker/7/string.rb +0 -54
- data/lib/zucker/7/tap.rb +0 -11
- data/lib/zucker/7/to_proc.rb +0 -4
- data/lib/zucker/7/unary.rb +0 -24
- data/lib/zucker/7/union.rb +0 -16
- data/lib/zucker/7/version.rb +0 -118
- data/lib/zucker/8/alias_for.rb +0 -21
- data/lib/zucker/8/aliases.rb +0 -51
- data/lib/zucker/8/all.rb +0 -4
- data/lib/zucker/8/array.rb +0 -25
- data/lib/zucker/8/array2proc.rb +0 -18
- data/lib/zucker/8/binding.rb +0 -33
- data/lib/zucker/8/blank.rb +0 -28
- data/lib/zucker/8/cc.rb +0 -25
- data/lib/zucker/8/class2proc.rb +0 -12
- data/lib/zucker/8/control.rb +0 -4
- data/lib/zucker/8/dd.rb +0 -23
- data/lib/zucker/8/debug.rb +0 -4
- data/lib/zucker/8/default.rb +0 -4
- data/lib/zucker/8/egonil.rb +0 -27
- data/lib/zucker/8/engine.rb +0 -68
- data/lib/zucker/8/enumerable.rb +0 -14
- data/lib/zucker/8/env.rb +0 -4
- data/lib/zucker/8/extensions.rb +0 -4
- data/lib/zucker/8/hash.rb +0 -27
- data/lib/zucker/8/hash2proc.rb +0 -16
- data/lib/zucker/8/info.rb +0 -192
- data/lib/zucker/8/iterate.rb +0 -27
- data/lib/zucker/8/ivars.rb +0 -28
- data/lib/zucker/8/kernel.rb +0 -34
- data/lib/zucker/8/mcopy.rb +0 -10
- data/lib/zucker/8/mm.rb +0 -34
- data/lib/zucker/8/not.rb +0 -19
- data/lib/zucker/8/object.rb +0 -4
- data/lib/zucker/8/oo.rb +0 -17
- data/lib/zucker/8/os.rb +0 -54
- data/lib/zucker/8/qq.rb +0 -12
- data/lib/zucker/8/regexp2proc.rb +0 -12
- data/lib/zucker/8/sandbox.rb +0 -25
- data/lib/zucker/8/shortcuts.rb +0 -4
- data/lib/zucker/8/square_brackets_for.rb +0 -21
- data/lib/zucker/8/string.rb +0 -54
- data/lib/zucker/8/tap.rb +0 -11
- data/lib/zucker/8/to_proc.rb +0 -4
- data/lib/zucker/8/unary.rb +0 -24
- data/lib/zucker/8/union.rb +0 -16
- data/lib/zucker/8/version.rb +0 -118
data/lib/zucker/3/class2proc.rb
DELETED
data/lib/zucker/3/debug.rb
DELETED
data/lib/zucker/3/default.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
require 'zucker'
|
4
|
-
|
5
|
-
# default
|
6
|
-
zucker = %w|
|
7
|
-
alias_for
|
8
|
-
aliases
|
9
|
-
array
|
10
|
-
array2proc
|
11
|
-
blank
|
12
|
-
class2proc
|
13
|
-
egonil
|
14
|
-
enumerable
|
15
|
-
hash
|
16
|
-
hash2proc
|
17
|
-
info
|
18
|
-
iterate
|
19
|
-
ivars
|
20
|
-
kernel
|
21
|
-
mcopy
|
22
|
-
not
|
23
|
-
regexp2proc
|
24
|
-
sandbox
|
25
|
-
square_brackets_for
|
26
|
-
string
|
27
|
-
tap
|
28
|
-
unary
|
29
|
-
union
|
30
|
-
|
|
31
|
-
|
32
|
-
# remove 1.9 if 1.8
|
33
|
-
if RUBY_VERSION < '1.9'
|
34
|
-
zucker -= %w|not tap union|
|
35
|
-
end
|
36
|
-
|
37
|
-
zucker.each{|rb| require File.join( 'zucker', '3', rb )}
|
data/lib/zucker/3/egonil.rb
DELETED
data/lib/zucker/3/enumerable.rb
DELETED
data/lib/zucker/3/hash.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
def self.zip(keys,values)
|
5
|
-
Hash[ *keys.zip( values ).flatten ]
|
6
|
-
end
|
7
|
-
|
8
|
-
def <<(other)
|
9
|
-
case
|
10
|
-
when other.is_a?(Hash)
|
11
|
-
merge! other
|
12
|
-
when other.is_a?(Enumerable) || other.respond_to?(:to_splat)
|
13
|
-
merge! Hash[*other]
|
14
|
-
else
|
15
|
-
raise TypeError, 'can only append other Hashs and Enumerables (or Classes that implement to_splat)'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# J-_-L
|
21
|
-
|
data/lib/zucker/3/hash2proc.rb
DELETED
data/lib/zucker/3/info.rb
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
module Info
|
4
|
-
class << Info
|
5
|
-
# hash like access
|
6
|
-
def [](what)
|
7
|
-
send what
|
8
|
-
end
|
9
|
-
|
10
|
-
# list available info methods
|
11
|
-
def list
|
12
|
-
singleton_methods - [:[], :list, '[]', 'list']
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
module_function
|
17
|
-
|
18
|
-
# current script file
|
19
|
-
def current_file
|
20
|
-
__FILE__
|
21
|
-
end
|
22
|
-
|
23
|
-
def current_file_directory
|
24
|
-
File.dirname(__FILE__)
|
25
|
-
end
|
26
|
-
|
27
|
-
# input
|
28
|
-
def last_input_file
|
29
|
-
$FILENAME
|
30
|
-
end
|
31
|
-
|
32
|
-
def last_input_line_number
|
33
|
-
$.
|
34
|
-
end
|
35
|
-
|
36
|
-
def last_input
|
37
|
-
$_
|
38
|
-
end
|
39
|
-
|
40
|
-
# program
|
41
|
-
def program_name
|
42
|
-
$0
|
43
|
-
end
|
44
|
-
|
45
|
-
def program_arguments
|
46
|
-
$:
|
47
|
-
end
|
48
|
-
|
49
|
-
def loaded_programs
|
50
|
-
$"
|
51
|
-
end
|
52
|
-
|
53
|
-
def program_data
|
54
|
-
::DATA
|
55
|
-
end
|
56
|
-
|
57
|
-
def child_program_status
|
58
|
-
$CHILD_STATUS
|
59
|
-
end
|
60
|
-
|
61
|
-
# system info
|
62
|
-
def environment
|
63
|
-
::ENV
|
64
|
-
end
|
65
|
-
alias env environment
|
66
|
-
|
67
|
-
def working_directory
|
68
|
-
Dir.pwd
|
69
|
-
end
|
70
|
-
|
71
|
-
def platform
|
72
|
-
::RUBY_PLATFORM
|
73
|
-
end
|
74
|
-
|
75
|
-
def process_id
|
76
|
-
$$
|
77
|
-
end
|
78
|
-
|
79
|
-
def load_path
|
80
|
-
$:
|
81
|
-
end
|
82
|
-
|
83
|
-
# current
|
84
|
-
def current_line
|
85
|
-
__LINE__
|
86
|
-
end
|
87
|
-
|
88
|
-
def current_method # 1.9
|
89
|
-
__method__
|
90
|
-
end
|
91
|
-
|
92
|
-
def current_callstack
|
93
|
-
caller
|
94
|
-
end
|
95
|
-
|
96
|
-
# dealing with strings
|
97
|
-
def gets_separator
|
98
|
-
$/
|
99
|
-
end
|
100
|
-
|
101
|
-
def join_separator
|
102
|
-
$,
|
103
|
-
end
|
104
|
-
|
105
|
-
def print_separator
|
106
|
-
$,
|
107
|
-
end
|
108
|
-
|
109
|
-
def split_separator
|
110
|
-
$;
|
111
|
-
end
|
112
|
-
|
113
|
-
# misc
|
114
|
-
def security_level
|
115
|
-
$SAFE
|
116
|
-
end
|
117
|
-
|
118
|
-
def warnings_activated?
|
119
|
-
$VERBOSE
|
120
|
-
end
|
121
|
-
|
122
|
-
def debug_activated?
|
123
|
-
$DEBUG
|
124
|
-
end
|
125
|
-
|
126
|
-
def last_exception
|
127
|
-
$!
|
128
|
-
end
|
129
|
-
|
130
|
-
# defined objects
|
131
|
-
def global_variables
|
132
|
-
Object.send :global_variables
|
133
|
-
end
|
134
|
-
|
135
|
-
def global_constants
|
136
|
-
Object.constants
|
137
|
-
end
|
138
|
-
|
139
|
-
# encoding (1.9)
|
140
|
-
def source_encoding
|
141
|
-
__ENCODING__
|
142
|
-
end
|
143
|
-
|
144
|
-
def external_encoding
|
145
|
-
Encoding.default_external
|
146
|
-
end
|
147
|
-
|
148
|
-
def internal_encoding
|
149
|
-
Encoding.default_internal
|
150
|
-
end
|
151
|
-
|
152
|
-
# ruby version info
|
153
|
-
def ruby_version
|
154
|
-
::RUBY_VERSION
|
155
|
-
end
|
156
|
-
|
157
|
-
def ruby_patchlevel
|
158
|
-
::RUBY_PATCHLEVEL
|
159
|
-
end
|
160
|
-
|
161
|
-
def ruby_description
|
162
|
-
::RUBY_DESCRIPTION
|
163
|
-
end
|
164
|
-
|
165
|
-
def ruby_release_date
|
166
|
-
::RUBY_RELEASE_DATE
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
data/lib/zucker/3/iterate.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
def iterate(*params)
|
4
|
-
# params.shift.zip(*params).each{ |*elements| yield *elements }
|
5
|
-
|
6
|
-
first = params.shift
|
7
|
-
if params.empty? # single param - like each
|
8
|
-
if block_given?
|
9
|
-
first.map{|e| yield e }
|
10
|
-
else
|
11
|
-
first.map
|
12
|
-
end
|
13
|
-
else
|
14
|
-
padded_first = Array.new( [first, *params].max_by(&:size).size ){|i| first[i] } # append nils
|
15
|
-
obj = padded_first.zip *params
|
16
|
-
if block_given?
|
17
|
-
obj.map{|es| yield *es }
|
18
|
-
else
|
19
|
-
obj.map.to_enum
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# J-_-L
|
25
|
-
|
data/lib/zucker/3/ivars.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
def instance_variables_from(obj, *only)
|
4
|
-
iter =
|
5
|
-
if obj.is_a? Binding
|
6
|
-
obj.eval('local_variables').map{|e| [obj.eval("#{e}"), e] }
|
7
|
-
elsif obj.is_a? Hash
|
8
|
-
obj.map{|k,v| [v,k] }
|
9
|
-
else
|
10
|
-
# elsif obj.is_a? Enumerable
|
11
|
-
obj.each.with_index
|
12
|
-
end
|
13
|
-
|
14
|
-
ret = []
|
15
|
-
iter.each{ |value, arg|
|
16
|
-
arg = arg.to_s
|
17
|
-
if only.include?(arg) || only.include?(arg.to_sym) || only.empty?
|
18
|
-
arg = '_' + arg if (48..57).member? arg.unpack('C')[0] # 1.8+1.9
|
19
|
-
ret << ivar = :"@#{arg}"
|
20
|
-
self.instance_variable_set ivar, value
|
21
|
-
end
|
22
|
-
}
|
23
|
-
ret
|
24
|
-
end
|
25
|
-
alias ivars instance_variables_from
|
26
|
-
|
27
|
-
# J-_-L
|
28
|
-
|
data/lib/zucker/3/kernel.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
module Kernel
|
4
|
-
def activate_warnings!
|
5
|
-
$VERBOSE = true
|
6
|
-
end
|
7
|
-
|
8
|
-
def deactivate_warnings!
|
9
|
-
$VERBOSE = false
|
10
|
-
end
|
11
|
-
|
12
|
-
def library?
|
13
|
-
__FILE__ != $PROGRAM_NAME
|
14
|
-
end
|
15
|
-
|
16
|
-
def executed_directly?
|
17
|
-
__FILE__ == $PROGRAM_NAME
|
18
|
-
end
|
19
|
-
alias standalone? executed_directly?
|
20
|
-
|
21
|
-
def ignore_sigint! # ctrl+c
|
22
|
-
Signal.trap *%w|SIGINT IGNORE|
|
23
|
-
end
|
24
|
-
|
25
|
-
# version getter
|
26
|
-
def ruby_1_9?
|
27
|
-
RUBY_VERSION[2,1] == '9'
|
28
|
-
end
|
29
|
-
|
30
|
-
def ruby_1_8?
|
31
|
-
RUBY_VERSION[2,1] == '8'
|
32
|
-
end
|
33
|
-
|
34
|
-
def ruby_1_9!
|
35
|
-
if RUBY_VERSION[2,1] != '9'
|
36
|
-
fail NotImplementedError, "Sorry, this script requires Ruby 1.9, but was executed with a different Ruby version!"
|
37
|
-
end
|
38
|
-
true
|
39
|
-
end
|
40
|
-
|
41
|
-
def ruby_1_8!
|
42
|
-
if RUBY_VERSION[2,1] != '8'
|
43
|
-
fail NotImplementedError, "Sorry, this script requires Ruby 1.8, but was executed with a different Ruby version!"
|
44
|
-
end
|
45
|
-
true
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# J-_-L
|
50
|
-
|
data/lib/zucker/3/mcopy.rb
DELETED
data/lib/zucker/3/mm.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'zucker'
|
2
|
-
|
3
|
-
module Kernel
|
4
|
-
def method_list(levels = 1)
|
5
|
-
if self.is_a? Module
|
6
|
-
klass, method_function = self, :public_methods
|
7
|
-
else
|
8
|
-
klass, method_function = self.class, :public_instance_methods
|
9
|
-
|
10
|
-
eigen = self.singleton_methods
|
11
|
-
if !eigen.empty?
|
12
|
-
puts :Eigenclass # sorry for not being up to date, I just love the word
|
13
|
-
p self.singleton_methods
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
levels.times{ |level|
|
18
|
-
if cur = klass.ancestors[level]
|
19
|
-
p cur # put class name
|
20
|
-
p cur.send method_function, false # put methods of the class
|
21
|
-
else
|
22
|
-
break
|
23
|
-
end
|
24
|
-
}
|
25
|
-
|
26
|
-
self # or whatever
|
27
|
-
end
|
28
|
-
|
29
|
-
alias mm method_list
|
30
|
-
end
|
31
|
-
|
32
|
-
# J-_-L
|
33
|
-
|