object_struct 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/object_struct/object_struct.rb +7 -7
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
# @abstract You probably want to subclass ObjectStruct, to reflect your business
|
26
26
|
# entities. See the README for example use.
|
27
27
|
class ObjectStruct < OpenStruct
|
28
|
-
VERSION = '0.0.
|
28
|
+
VERSION = '0.0.7'
|
29
29
|
|
30
30
|
# Delegated to Hash#each
|
31
31
|
def each &blk
|
@@ -91,6 +91,12 @@ class ObjectStruct < OpenStruct
|
|
91
91
|
def id
|
92
92
|
object_id
|
93
93
|
end
|
94
|
+
|
95
|
+
def to_h
|
96
|
+
result = {}
|
97
|
+
@table.each {|name, value| result[name.to_s] = value}
|
98
|
+
result
|
99
|
+
end
|
94
100
|
|
95
101
|
protected
|
96
102
|
|
@@ -134,12 +140,6 @@ class ObjectStruct < OpenStruct
|
|
134
140
|
|
135
141
|
private
|
136
142
|
|
137
|
-
def to_h
|
138
|
-
result = {}
|
139
|
-
@table.each {|name, value| result[name.to_s] = value}
|
140
|
-
result
|
141
|
-
end
|
142
|
-
|
143
143
|
def self.value_maybe_promise(key, value)
|
144
144
|
case value
|
145
145
|
when Array, Hash
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Quid, Inc.
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-07 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|