Skip to content

Commit 30327ee

Browse files
committed
Recursively converting child hash attributes to OpenStruct.
1 parent 06d37e6 commit 30327ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ostruct.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def initialize(hash=nil)
9393
if hash
9494
hash.each_pair do |k, v|
9595
k = k.to_sym
96-
@table[k] = v
96+
@table[k] = v.is_a?(Hash) ? OpenStruct.new(v) : v
9797
end
9898
end
9999
end

0 commit comments

Comments
 (0)