cistern 0.2.0 → 0.2.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/cistern/formatter/awesome_print.rb +8 -0
- data/lib/cistern/version.rb +1 -1
- data/spec/cistern_spec.rb +1 -1
- metadata +1 -1
@@ -16,6 +16,8 @@ module AwesomePrint::Cistern
|
|
16
16
|
cast = cast_without_cistern(object, type)
|
17
17
|
if object.is_a?(Cistern::Model)
|
18
18
|
cast = :cistern_model
|
19
|
+
elsif object.is_a?(Cistern::Collection)
|
20
|
+
cast = :cistern_collection
|
19
21
|
end
|
20
22
|
cast
|
21
23
|
end
|
@@ -26,6 +28,12 @@ module AwesomePrint::Cistern
|
|
26
28
|
data = object.attributes.keys.inject({}){|r,k| r.merge(k => object.send(k))}
|
27
29
|
"#{object} " << awesome_hash(data)
|
28
30
|
end
|
31
|
+
|
32
|
+
# Format Cistern::Model
|
33
|
+
#------------------------------------------------------------------------------
|
34
|
+
def awesome_cistern_collection(object)
|
35
|
+
"#{object.class.name} " << awesome_array(object)
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
AwesomePrint::Formatter.send(:include, AwesomePrint::Cistern)
|
data/lib/cistern/version.rb
CHANGED
data/spec/cistern_spec.rb
CHANGED
@@ -57,7 +57,7 @@ describe "#inspect" do
|
|
57
57
|
end
|
58
58
|
it "should use awesome_print" do
|
59
59
|
Cistern.formatter = Cistern::Formatter::AwesomePrint
|
60
|
-
Inspectors.new.all.inspect.should match(
|
60
|
+
Inspectors.new.all.inspect.should match(/Inspectors\s+\[.*\]$/m) # close enough
|
61
61
|
end
|
62
62
|
it "should use formatador"
|
63
63
|
end
|