Class: SBF::Client::NotImplementedObject
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- SBF::Client::NotImplementedObject
- Defined in:
- lib/stbaldricks/entities/lib/not_implemented_object.rb
Constant Summary
Constants inherited from BaseEntity
Instance Attribute Summary collapse
-
#props ⇒ Object
Returns the value of attribute props.
Attributes inherited from BaseEntity
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ NotImplementedObject
constructor
A new instance of NotImplementedObject.
- #method_missing(name) ⇒ Object
- #to_hash ⇒ Object
Methods inherited from BaseEntity
#add_errors, allow_instantiation?, attr_accessor, attr_reader, attr_writer, attributes, #attributes=, collection_attributes, entity_attr_accessor, entity_attr_reader, entity_attr_writer, entity_attributes, entity_collection_attr_accessor, entity_collection_attr_reader, entity_collection_attr_writer, inherited, #model_name, multitype_attr_accessor, multitype_attr_reader, multitype_attr_writer, multitype_collection_attr_accessor, multitype_collection_attr_reader, multitype_collection_attr_writer, #not_provided_attributes, optional_attributes, #persisted?, #to_json
Constructor Details
#initialize(attributes = {}) ⇒ NotImplementedObject
Returns a new instance of NotImplementedObject.
9 10 11 12 13 14 15 16 17 |
# File 'lib/stbaldricks/entities/lib/not_implemented_object.rb', line 9 def initialize(attributes = {}) @props = {}.tap { |hsh| attributes.each { |k, v| hsh[k.to_sym] = v } } super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
19 20 21 22 |
# File 'lib/stbaldricks/entities/lib/not_implemented_object.rb', line 19 def method_missing(name) return @props[name.to_sym] if @props.key?(name.to_sym) super.method_missing(name) end |
Instance Attribute Details
#props ⇒ Object
Returns the value of attribute props.
7 8 9 |
# File 'lib/stbaldricks/entities/lib/not_implemented_object.rb', line 7 def props @props end |
Instance Method Details
#to_hash ⇒ Object
24 25 26 27 28 29 |
# File 'lib/stbaldricks/entities/lib/not_implemented_object.rb', line 24 def to_hash {}.tap do |hsh| props.each { |k, v| hsh[k] = v } self.class.attributes.each { |name| hsh[name] = send(name.to_sym) unless hsh.key?(name.to_sym) || name.to_sym == :props } end end |