rdoba 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +4 -4
- data/README.md +21 -27
- data/Rakefile +21 -19
- data/features/step_definitions/mixin_steps.rb +237 -198
- data/features/support/env.rb +26 -160
- data/features/support/mixin_support.rb +13 -9
- data/lib/rdoba/_version_.rb +3 -1
- data/lib/rdoba/a.rb +44 -42
- data/lib/rdoba/bcd.rb +43 -26
- data/lib/rdoba/blank.rb +14 -0
- data/lib/rdoba/combinations.rb +17 -15
- data/lib/rdoba/common.rb +53 -53
- data/lib/rdoba/debug.rb +7 -5
- data/lib/rdoba/deploy.rb +55 -50
- data/lib/rdoba/dup.rb +31 -31
- data/lib/rdoba/fe.rb +6 -5
- data/lib/rdoba/gem.rb +33 -29
- data/lib/rdoba/hashorder.rb +24 -24
- data/lib/rdoba/io.rb +81 -74
- data/lib/rdoba/merge.rb +16 -16
- data/lib/rdoba/mixin/time.rb +13 -7
- data/lib/rdoba/mixin/try.rb +10 -5
- data/lib/rdoba/mixin/try_1_9_0.rb +8 -3
- data/lib/rdoba/mixin/wait_if.rb +24 -18
- data/lib/rdoba/mixin.rb +363 -306
- data/lib/rdoba/numeric.rb +19 -17
- data/lib/rdoba/os.rb +127 -0
- data/lib/rdoba/re.rb +4 -4
- data/lib/rdoba/require.rb +24 -19
- data/lib/rdoba/roman.rb +47 -35
- data/lib/rdoba/strings.rb +5 -6
- data/lib/rdoba/yaml.rb +20 -18
- data/lib/rdoba.rb +53 -44
- data/rdoba.gemspec +10 -9
- metadata +44 -46
- data/features/log.feature +0 -277
- data/features/step_definitions/log_steps.rb +0 -200
- data/features/support/fulltest_as_log.rb.in +0 -143
- data/features/support/fulltest_as_self.rb.in +0 -144
- data/lib/rdoba/log.rb +0 -419
data/lib/rdoba/common.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
class Object
|
5
5
|
def xor(val1)
|
6
|
-
val0 =
|
7
|
-
(
|
6
|
+
val0 = !!self
|
7
|
+
(val0 and !val1) or (!val0 and val1)
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
# calls any method
|
11
|
+
def co(method, *_args)
|
11
12
|
eval "#{method}(*args)"
|
12
13
|
end
|
13
14
|
|
@@ -20,34 +21,36 @@ class Object
|
|
20
21
|
opts.each do |opt|
|
21
22
|
case opt.class.to_s.to_sym
|
22
23
|
when :Hash
|
23
|
-
|
24
|
+
opt.each do |x, y|
|
25
|
+
v[x] = y
|
26
|
+
end
|
24
27
|
when :Array
|
25
|
-
|
28
|
+
opt.each do |x|
|
29
|
+
v[x] = true
|
30
|
+
end
|
26
31
|
when :Symbol
|
27
|
-
|
32
|
+
v[opt] = true
|
28
33
|
end
|
29
34
|
end
|
30
35
|
v
|
31
36
|
end
|
32
37
|
|
33
38
|
def apply_opts(opts)
|
34
|
-
parse_opts(opts).each do |x,y|
|
35
|
-
self.instance_variable_set("@#{x}".to_sym, y)
|
36
|
-
end
|
39
|
+
parse_opts(opts).each do |x, y| instance_variable_set("@#{x}".to_sym, y)end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
43
|
class NilClass
|
41
44
|
def =~(value)
|
42
|
-
value
|
45
|
+
value.nil?
|
43
46
|
end
|
44
47
|
|
45
|
-
def +(
|
46
|
-
|
48
|
+
def +(other)
|
49
|
+
other
|
47
50
|
end
|
48
51
|
|
49
52
|
def <<(value)
|
50
|
-
[
|
53
|
+
[value]
|
51
54
|
end
|
52
55
|
|
53
56
|
def empty?
|
@@ -57,59 +60,58 @@ class NilClass
|
|
57
60
|
def to_i
|
58
61
|
0
|
59
62
|
end
|
60
|
-
alias
|
63
|
+
alias ord to_i
|
61
64
|
|
62
65
|
def size
|
63
66
|
0
|
64
67
|
end
|
65
68
|
|
66
|
-
def <=>(
|
69
|
+
def <=>(_other)
|
67
70
|
-1
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
71
|
-
|
72
74
|
class Array
|
73
75
|
def purge
|
74
|
-
|
76
|
+
compact.delete_if { |x| x.empty? }
|
75
77
|
end
|
76
78
|
|
77
79
|
def >>(value = nil)
|
78
80
|
value ? delete(value) : shift
|
79
81
|
end
|
80
82
|
|
81
|
-
alias
|
83
|
+
alias __get__ []
|
82
84
|
def [](index, *args)
|
83
|
-
return __get__(index.to_i, *args) if index.
|
85
|
+
return __get__(index.to_i, *args) if index.instance_of?(String) and index =~ /^\d+$/
|
86
|
+
|
84
87
|
__get__(index, *args)
|
85
88
|
end
|
86
89
|
|
87
|
-
alias
|
90
|
+
alias __set__ []=
|
88
91
|
def []=(index, value, *args)
|
89
|
-
return __set__(index.to_i, value, *args) if index.
|
92
|
+
return __set__(index.to_i, value, *args) if index.instance_of?(String) and index =~ /^\d+$/
|
93
|
+
|
90
94
|
__set__(index, value, *args)
|
91
95
|
end
|
92
96
|
end
|
93
97
|
|
94
98
|
class String
|
95
|
-
def -(
|
96
|
-
#TODO make smart search for match in the 'str', when only last subpart matched to 'self'
|
97
|
-
len =
|
99
|
+
def -(other)
|
100
|
+
# TODO: make smart search for match in the 'str', when only last subpart matched to 'self'
|
101
|
+
len = size
|
98
102
|
bc = ec = nil
|
99
103
|
(0...len).each do |idx|
|
100
|
-
break bc = idx if self[idx] ==
|
104
|
+
break bc = idx if self[idx] == other[0]
|
101
105
|
end
|
102
|
-
((bc + 1)...len).each do |idx|
|
103
|
-
|
104
|
-
end if bc
|
105
|
-
(not bc) ? self.clone : (not ec) ? self[0, bc] : self[0, bc] + self[ec, len - ec]
|
106
|
+
((bc + 1)...len).each do |idx| break ec = idx if self[idx] != other[idx - bc]end if bc
|
107
|
+
bc ? ec ? self[0, bc] + self[ec, len - ec] : self[0, bc] : clone
|
106
108
|
end
|
107
109
|
|
108
|
-
alias
|
110
|
+
alias __match__ =~
|
109
111
|
def =~(value)
|
110
|
-
if value.
|
112
|
+
if value.instance_of?(String)
|
111
113
|
self == value
|
112
|
-
elsif value.
|
114
|
+
elsif value.instance_of?(Regexp)
|
113
115
|
value =~ self
|
114
116
|
else
|
115
117
|
__match__(value)
|
@@ -117,14 +119,14 @@ class String
|
|
117
119
|
end
|
118
120
|
|
119
121
|
def rmatch(value)
|
120
|
-
self == value || self =~
|
122
|
+
self == value || self =~ %r{^/([^/]+)} && value =~ /#{Regexp.last_match(1)}/
|
121
123
|
end
|
122
124
|
|
123
125
|
def hexdump
|
124
|
-
res= ''
|
126
|
+
res = ''
|
125
127
|
i = 0
|
126
|
-
|
127
|
-
res <<
|
128
|
+
each_byte do |byte|
|
129
|
+
res << format('%.2X ', byte)
|
128
130
|
i += 1
|
129
131
|
res << "\n" if i % 16 == 0
|
130
132
|
end
|
@@ -133,13 +135,13 @@ class String
|
|
133
135
|
end
|
134
136
|
|
135
137
|
class Hash
|
136
|
-
def |(
|
137
|
-
res =
|
138
|
-
|
139
|
-
if val.
|
140
|
-
if val.
|
141
|
-
res[key] |=
|
142
|
-
elsif val.
|
138
|
+
def |(other)
|
139
|
+
res = dup
|
140
|
+
other.each_pair do |key, val|
|
141
|
+
if val.instance_of?(res[key].class)
|
142
|
+
if val.instance_of?(Hash)
|
143
|
+
res[key] |= other[key]
|
144
|
+
elsif val.instance_of?(Array)
|
143
145
|
res[key].concat val
|
144
146
|
else
|
145
147
|
res[key] = val
|
@@ -157,19 +159,17 @@ class Hash
|
|
157
159
|
|
158
160
|
def reverse
|
159
161
|
h = {}
|
160
|
-
|
162
|
+
each_pair do |key, value|
|
161
163
|
if h.key? value
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
if h[value].instance_of?(Array)
|
165
|
+
h[value] << key
|
166
|
+
else
|
167
|
+
h[value] = [h[value], key]
|
168
|
+
end
|
167
169
|
else
|
168
|
-
|
170
|
+
h[value] = key
|
169
171
|
end
|
170
172
|
end
|
171
173
|
h
|
172
174
|
end
|
173
175
|
end
|
174
|
-
|
175
|
-
|
data/lib/rdoba/debug.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
"Please use 'rdoba :log' form instead"
|
3
|
+
warn "Warning: the module has kept only for backward compatibility\n" \
|
4
|
+
"Please use 'rdoba :log' form instead"
|
5
5
|
|
6
6
|
require 'rdoba/log'
|
7
7
|
|
8
8
|
module Rdoba
|
9
|
-
|
10
|
-
|
9
|
+
def self.debug(options = {})
|
10
|
+
Rdoba.log options
|
11
|
+
end
|
12
|
+
end
|
data/lib/rdoba/deploy.rb
CHANGED
@@ -1,74 +1,80 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'rdoba/common'
|
5
5
|
|
6
6
|
class Hash
|
7
|
-
|
8
7
|
def deploy!(vars = {})
|
9
|
-
|
10
|
-
# TODO add variable copy
|
8
|
+
replace deploy(vars)
|
9
|
+
# TODO: add variable copy
|
11
10
|
end
|
12
11
|
|
13
12
|
def deploy(vars = {})
|
14
13
|
res = {}
|
15
14
|
|
16
|
-
|
17
|
-
if x
|
18
|
-
|
15
|
+
keys.sort do |x, y|
|
16
|
+
if /=$/.match?(x)
|
17
|
+
/=$/.match?(y) ? x <=> y : -1
|
19
18
|
else
|
20
|
-
|
19
|
+
/=$/.match?(y) ? 1 : x <=> y
|
21
20
|
end
|
22
21
|
end.each do |key|
|
23
|
-
|
24
22
|
if key =~ /(.*)=$/
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
vars[Regexp.last_match(1)] = self[key]
|
24
|
+
next
|
28
25
|
elsif key =~ /(.*)@$/
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
sym = Regexp.last_match(1)
|
27
|
+
eval "res.class.co( :attr_accessor, :#{sym})"
|
28
|
+
eval "res.#{sym} = self[key]"
|
29
|
+
next
|
34
30
|
elsif key =~ /^%([^%].*)/
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
if var.class == Hash
|
39
|
-
res |= var.deploy(vars)
|
40
|
-
elsif var.class == String
|
41
|
-
res[var] = nil
|
42
|
-
else
|
43
|
-
raise "Undeployable hash #{$1} value class #{var.class}"
|
44
|
-
end
|
45
|
-
next
|
31
|
+
unless vars.key?(Regexp.last_match(1))
|
32
|
+
next warn 'Warning: undefined variable ' + "#{Regexp.last_match(1).inspect} found. Ignoring..."
|
33
|
+
end
|
46
34
|
|
35
|
+
var = vars[Regexp.last_match(1)].dup
|
36
|
+
if var.instance_of?(Hash)
|
37
|
+
res |= var.deploy(vars)
|
38
|
+
elsif var.instance_of?(String)
|
39
|
+
res[var] = nil
|
40
|
+
else
|
41
|
+
raise "Undeployable hash #{Regexp.last_match(1)} value class #{var.class}"
|
42
|
+
end
|
43
|
+
next
|
47
44
|
elsif key =~ /^%%(.*)/
|
48
|
-
|
45
|
+
key.replace Regexp.last_match(1).to_s
|
49
46
|
end
|
50
47
|
|
51
48
|
def deploy_value(value, vars)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
49
|
+
case value.class.to_sym
|
50
|
+
when :String
|
51
|
+
if value =~ /^%([^%].*)/
|
52
|
+
begin
|
53
|
+
vars[Regexp.last_match(1)].deploy(vars)
|
54
|
+
rescue StandardError
|
55
|
+
nil
|
56
|
+
end
|
57
|
+
elsif value =~ /(.*)%([A-Za-z0-9_А-я]+)(.*)/
|
58
|
+
a = [Regexp.last_match(1).to_s, Regexp.last_match(2).to_s, Regexp.last_match(3).to_s]
|
59
|
+
a[1] =
|
60
|
+
begin
|
61
|
+
vars[a[1]].deploy(vars).to_s
|
62
|
+
rescue StandardError
|
63
|
+
vars[a[1]]
|
64
|
+
end
|
65
|
+
a.join
|
66
|
+
else
|
67
|
+
value
|
68
|
+
end
|
69
|
+
when :Hash
|
70
|
+
value.deploy(vars)
|
71
|
+
when :Array
|
72
|
+
value.map do |sub|
|
73
|
+
deploy_value(sub, vars)
|
74
|
+
end
|
75
|
+
else
|
76
|
+
value
|
77
|
+
end
|
72
78
|
end
|
73
79
|
|
74
80
|
value = self[key]
|
@@ -77,4 +83,3 @@ class Hash
|
|
77
83
|
res
|
78
84
|
end
|
79
85
|
end
|
80
|
-
|
data/lib/rdoba/dup.rb
CHANGED
@@ -1,64 +1,64 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
class Array
|
5
|
-
alias
|
5
|
+
alias __dup__ dup
|
6
6
|
def dup(opts = {})
|
7
|
-
if
|
7
|
+
if opts.instance_of?(Hash) ? opts.key?(:recursive) : opts.to_s.to_sym == :recursive
|
8
8
|
res = []
|
9
9
|
|
10
10
|
def sub_dup(value)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
if /(Hash|Array)/.match?(value.class.to_s)
|
12
|
+
value.dup(:recursive)
|
13
|
+
else
|
14
|
+
begin
|
15
|
+
value.dup
|
16
|
+
rescue StandardError
|
17
|
+
new = value
|
18
|
+
end
|
19
|
+
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
each do |value|
|
23
|
+
res << sub_dup(value)
|
24
|
+
end
|
23
25
|
|
24
26
|
res
|
25
27
|
elsif opts.empty?
|
26
28
|
__dup__
|
27
29
|
else
|
28
|
-
raise "Unsupported option(s): #{opts.
|
30
|
+
raise "Unsupported option(s): #{opts.instance_of?(Hash) ? opts.keys.join(', ') : opts}"
|
29
31
|
end
|
30
32
|
end
|
31
|
-
|
32
33
|
end
|
33
34
|
|
34
35
|
class Hash
|
35
|
-
alias
|
36
|
+
alias __dup__ dup
|
36
37
|
def dup(opts = {})
|
37
|
-
if
|
38
|
+
if opts.instance_of?(Hash) ? opts.key?(:recursive) : opts.to_s.to_sym == :recursive
|
38
39
|
res = {}
|
39
40
|
|
40
41
|
def sub_dup(value)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
if /(Hash|Array)/.match?(value.class.to_s)
|
43
|
+
value.dup(:recursive)
|
44
|
+
else
|
45
|
+
begin
|
46
|
+
value.dup
|
47
|
+
rescue StandardError
|
48
|
+
new = value
|
49
|
+
end
|
50
|
+
end
|
50
51
|
end
|
51
52
|
|
52
|
-
|
53
|
+
each do |key, value|
|
54
|
+
res[sub_dup(key)] = sub_dup(value)
|
55
|
+
end
|
53
56
|
|
54
57
|
res
|
55
58
|
elsif opts.empty?
|
56
59
|
__dup__
|
57
60
|
else
|
58
|
-
raise "Unsupported option(s): #{opts.
|
61
|
+
raise "Unsupported option(s): #{opts.instance_of?(Hash) ? opts.keys.join(', ') : opts}"
|
59
62
|
end
|
60
63
|
end
|
61
|
-
|
62
64
|
end
|
63
|
-
|
64
|
-
|
data/lib/rdoba/fe.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
class String
|
4
5
|
def fe
|
@@ -6,13 +7,13 @@ class String
|
|
6
7
|
self
|
7
8
|
else
|
8
9
|
return self unless Encoding.default_internal
|
9
|
-
|
10
|
-
|
10
|
+
|
11
|
+
if frozen?
|
12
|
+
dup.force_encoding(Encoding.default_internal || 'UTF-8').freeze
|
11
13
|
else
|
12
|
-
|
14
|
+
force_encoding(Encoding.default_internal || 'UTF-8')
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
16
|
-
alias
|
18
|
+
alias fenc fe
|
17
19
|
end
|
18
|
-
|
data/lib/rdoba/gem.rb
CHANGED
@@ -1,36 +1,40 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'rbconfig'
|
5
5
|
|
6
6
|
module Rdoba
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
File.join g.full_gem_path, 'share', 'settings.yaml'
|
12
|
-
end
|
7
|
+
def self.gemroot(gemname = nil, _path = '')
|
8
|
+
unless gem
|
9
|
+
raise 'Undefined gem name'
|
10
|
+
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
case host_os
|
18
|
-
when /(mswin|msys|mingw|cygwin|bccwin|wince|emc)/
|
19
|
-
plat = $1 == 'mswin' && 'native' || $1
|
20
|
-
out = `ver`.encode( 'US-ASCII',
|
21
|
-
:invalid => :replace, :undef => :replace )
|
22
|
-
if out =~ /\[.* (\d+)\.([\d\.]+)\]/
|
23
|
-
"windows-#{plat}-#{$1 == '5' && 'xp' || 'vista'}-#{$1}.#{$2}"
|
24
|
-
else
|
25
|
-
"windows-#{plat}" ; end
|
26
|
-
when /darwin|mac os/
|
27
|
-
'macosx'
|
28
|
-
when /linux/
|
29
|
-
'linux'
|
30
|
-
when /(solaris|bsd)/
|
31
|
-
"unix-#{$1}"
|
32
|
-
else
|
33
|
-
raise "unknown os: #{host_os.inspect}"
|
34
|
-
end)
|
35
|
-
end ; end
|
12
|
+
g = Gem::Specification.find_by_name(gemname)
|
13
|
+
File.join g.full_gem_path, 'share', 'settings.yaml'
|
14
|
+
end
|
36
15
|
|
16
|
+
def self.os
|
17
|
+
@@os ||=
|
18
|
+
begin
|
19
|
+
host_os = RbConfig::CONFIG['host_os']
|
20
|
+
case host_os
|
21
|
+
when /(mswin|msys|mingw|cygwin|bccwin|wince|emc)/
|
22
|
+
plat = Regexp.last_match(1) == 'mswin' && 'native' || Regexp.last_match(1)
|
23
|
+
out = `ver`.encode('US-ASCII', invalid: :replace, undef: :replace)
|
24
|
+
if out =~ /\[.* (\d+)\.([\d.]+)\]/
|
25
|
+
"windows-#{plat}-#{Regexp.last_match(1) == '5' && 'xp' || 'vista'}-#{Regexp.last_match(1)}.#{Regexp.last_match(2)}"
|
26
|
+
else
|
27
|
+
"windows-#{plat}"
|
28
|
+
end
|
29
|
+
when /darwin|mac os/
|
30
|
+
'macosx'
|
31
|
+
when /linux/
|
32
|
+
'linux'
|
33
|
+
when /(solaris|bsd)/
|
34
|
+
"unix-#{Regexp.last_match(1)}"
|
35
|
+
else
|
36
|
+
raise "unknown os: #{host_os.inspect}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/rdoba/hashorder.rb
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
class Hash
|
4
5
|
attr_reader :order
|
5
6
|
|
6
7
|
class Each
|
7
8
|
General = 0
|
8
|
-
Pair
|
9
|
-
Key
|
10
|
-
Value
|
9
|
+
Pair = 1
|
10
|
+
Key = 2
|
11
|
+
Value = 3
|
11
12
|
end
|
12
13
|
|
13
|
-
private
|
14
|
+
private
|
14
15
|
|
15
16
|
def each_special(spec)
|
16
|
-
(@order |
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
(@order | keys).each do |key|
|
18
|
+
next unless has_key? key
|
19
|
+
|
20
|
+
case spec
|
21
|
+
when Hash::Each::General
|
22
|
+
yield key, self[key]
|
23
|
+
when Hash::Each::Pair
|
24
|
+
yield key, self[key]
|
25
|
+
when Hash::Each::Key
|
26
|
+
yield key
|
27
|
+
when Hash::Each::Value
|
28
|
+
yield self[key]
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
public
|
33
|
+
public
|
33
34
|
|
34
35
|
def order=(order)
|
35
36
|
return nil if order.class != Array
|
@@ -38,13 +39,14 @@ public
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def disorder
|
41
|
-
@order = nil
|
42
|
+
@order = nil
|
43
|
+
self
|
42
44
|
end
|
43
45
|
|
44
|
-
alias
|
45
|
-
alias
|
46
|
-
alias
|
47
|
-
alias
|
46
|
+
alias __each__ each
|
47
|
+
alias __each_pair__ each_pair
|
48
|
+
alias __each_key__ each_key
|
49
|
+
alias __each_value__ each_value
|
48
50
|
|
49
51
|
def each(&block)
|
50
52
|
@order ? each_special(Hash::Each::General, &block) : __each__(&block)
|
@@ -61,6 +63,4 @@ public
|
|
61
63
|
def each_value(&block)
|
62
64
|
@order ? each_special(Hash::Each::Value, &block) : __each_value__(&block)
|
63
65
|
end
|
64
|
-
|
65
66
|
end
|
66
|
-
|