ozy 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/ozy.rb +8 -0
  2. data/spec/ozy_spec.rb +10 -0
  3. metadata +3 -3
data/lib/ozy.rb CHANGED
@@ -61,6 +61,14 @@ class Ozy < ::Hash
61
61
  merge! attributes unless attributes.empty?
62
62
  end
63
63
 
64
+ def inspect
65
+ if persisted?
66
+ "#{@options[:key]}: #{super}"
67
+ else
68
+ super
69
+ end
70
+ end
71
+
64
72
  def merge!(*args)
65
73
  super
66
74
  update_parent
data/spec/ozy_spec.rb CHANGED
@@ -103,4 +103,14 @@ describe Ozy do
103
103
  ozy = Ozy.create("ozy", :foo => {:bar => [:baz]})
104
104
  Ozy.get("ozy").should == {:foo => {:bar => [:baz]}}
105
105
  end
106
+
107
+ it "should look like a Hash inspect when not persisted" do
108
+ ozy = Ozy.new(:foo => :bar)
109
+ ozy.inspect.should == {:foo => :bar}.inspect
110
+ end
111
+
112
+ it "should include the key on inspect when persisted" do
113
+ ozy = Ozy.create("ozy", :foo => :bar)
114
+ ozy.inspect.should == "ozy: #{{:foo => :bar}.inspect}"
115
+ end
106
116
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ozy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Flip Sasser