confstruct 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -191,6 +191,7 @@ The pattern `add_$key!` can be used to add to or create an array.
|
|
191
191
|
- <b>v0.2.0</b> - Add fallback value to HashWithStructAccess#lookup!, native support for Rails I18n.
|
192
192
|
- <b>v0.2.1</b> - Initialize properly from a nested hash with string (non-symbol) keys
|
193
193
|
- <b>v0.2.2</b> - Fix ArgumentError on #respond_to?(sym, true)
|
194
|
+
- <b>v0.2.3</b> - Don't evaluate Deferreds during #inspect
|
194
195
|
|
195
196
|
## Contributing to confstruct
|
196
197
|
|
data/lib/confstruct.rb
CHANGED
@@ -2,7 +2,15 @@ require 'delegate'
|
|
2
2
|
require 'confstruct/utils'
|
3
3
|
|
4
4
|
module Confstruct
|
5
|
-
class Deferred < Proc
|
5
|
+
class Deferred < Proc
|
6
|
+
def inspect(full=false)
|
7
|
+
if full
|
8
|
+
super
|
9
|
+
else
|
10
|
+
"(deferred)"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
6
14
|
def self.deferred █ Deferred.new(&block); end
|
7
15
|
|
8
16
|
def self.i18n key=nil, &block
|
@@ -128,7 +136,7 @@ module Confstruct
|
|
128
136
|
end
|
129
137
|
|
130
138
|
def inspect
|
131
|
-
r = self.keys.collect { |k| "#{k.inspect}=>#{self
|
139
|
+
r = self.keys.collect { |k| "#{k.inspect}=>#{self.fetch(k).inspect}" }
|
132
140
|
"{#{r.compact.join(', ')}}"
|
133
141
|
end
|
134
142
|
|
@@ -209,9 +209,9 @@ describe Confstruct::HashWithStructAccess do
|
|
209
209
|
@hwsa.github.values.should include(@hash[:github][:url].reverse)
|
210
210
|
end
|
211
211
|
|
212
|
-
it "should evaluate deferreds when inspecting" do
|
212
|
+
it "should not evaluate deferreds when inspecting" do
|
213
213
|
s = @hwsa.inspect
|
214
|
-
s.should =~ %r
|
214
|
+
s.should =~ %r{:reverse_url=>\(deferred\)}
|
215
215
|
s.should =~ %r[:regular_proc=>#<Proc:]
|
216
216
|
end
|
217
217
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confstruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Klein
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-05-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: active_support
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
requirements: []
|
173
173
|
|
174
174
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.8.
|
175
|
+
rubygems_version: 1.8.21
|
176
176
|
signing_key:
|
177
177
|
specification_version: 3
|
178
178
|
summary: A simple, hash/struct-based configuration object
|