lib/jess/resource.rb in jess-0.1.0 vs lib/jess/resource.rb in jess-0.2.0
- old
+ new
@@ -9,10 +9,14 @@
def initialize(json)
@_json = json.freeze
end
+ def to_hash
+ _json
+ end
+
private
def method_missing(symbol, *args)
if _json.key?(symbol.to_s)
_as_resource(_json.public_send(:[], symbol.to_s, *args))
@@ -28,12 +32,12 @@
def _as_resource(json)
case json
when Hash
Resource.new(json)
when Array
- json.map(&method(:_as_resource))
+ json.map(&method(:_as_resource)).freeze
else
- json
+ json.freeze
end
end
end
end