o 1.0.0 → 1.0.1
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.
- data/lib/o.rb +17 -1
- data/version.rb +1 -1
- metadata +2 -2
data/lib/o.rb
CHANGED
@@ -38,6 +38,8 @@ class O < Hash
|
|
38
38
|
#
|
39
39
|
# @example
|
40
40
|
# option = O.load("~/.gutenrc")
|
41
|
+
#
|
42
|
+
# option = O.load("/absolute/path/a.rb")
|
41
43
|
#
|
42
44
|
# O::Path << "/home"
|
43
45
|
# option = O.load("guten") #=> try guten.rb; then try guten
|
@@ -50,6 +52,8 @@ class O < Hash
|
|
50
52
|
if name =~ /^~/
|
51
53
|
file = File.expand_path(name)
|
52
54
|
path = file if File.exists?(file)
|
55
|
+
elsif File.absolute_path(name) == name
|
56
|
+
path = name if File.exists?(name)
|
53
57
|
else
|
54
58
|
catch :break do
|
55
59
|
PATH.each do |p|
|
@@ -138,6 +142,10 @@ class O < Hash
|
|
138
142
|
self
|
139
143
|
end
|
140
144
|
|
145
|
+
def _merge! data
|
146
|
+
end
|
147
|
+
|
148
|
+
|
141
149
|
#
|
142
150
|
# _method goes to @_data.send(_method, ..)
|
143
151
|
# method? #=> !! @_data[:method]
|
@@ -150,7 +158,15 @@ class O < Hash
|
|
150
158
|
elsif method =~ /(.*)\?$/
|
151
159
|
!! @_data[$1.to_sym]
|
152
160
|
elsif method =~ /^_(.*)/
|
153
|
-
|
161
|
+
method = $1.to_sym
|
162
|
+
args.map!{|arg| O===arg ? arg._data : arg}
|
163
|
+
rst = @_data.send(method, *args, &blk)
|
164
|
+
|
165
|
+
if [:merge!].include method
|
166
|
+
self
|
167
|
+
elsif [:merge].include method
|
168
|
+
O.new(rst)
|
169
|
+
end
|
154
170
|
else
|
155
171
|
@_data[method]
|
156
172
|
end
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: o
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Guten
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-02 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: |
|