Class: RestResource::Value
- Inherits:
-
Object
- Object
- RestResource::Value
- Defined in:
- lib/rest_resource/value.rb
Instance Method Summary collapse
-
#initialize(raw_value) ⇒ Value
constructor
A new instance of Value.
- #value ⇒ Object
Constructor Details
#initialize(raw_value) ⇒ Value
Returns a new instance of Value.
5 6 7 |
# File 'lib/rest_resource/value.rb', line 5 def initialize(raw_value) @raw_value = raw_value end |
Instance Method Details
#value ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rest_resource/value.rb', line 9 def value return raw_value if !raw_value.is_a?(Hash) or raw_value["object"].nil? class_name = raw_value["object"].keys.first klass = class_name.classify.constantize klass.new raw_value["object"][class_name] end |