Class: EdgycircleToolbox::Sonapi::Blueprint
- Inherits:
-
Object
- Object
- EdgycircleToolbox::Sonapi::Blueprint
- Defined in:
- lib/edgycircle_toolbox/sonapi/blueprint.rb
Instance Attribute Summary collapse
-
#attribute_names(object) ⇒ Object
Returns the value of attribute attribute_names.
-
#dynamic_attributes ⇒ Object
Returns the value of attribute dynamic_attributes.
-
#parameter_filter ⇒ Object
Returns the value of attribute parameter_filter.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #add_attribute(attribute_name) ⇒ Object
- #deserialize_parameter?(name, value) ⇒ Boolean
-
#initialize(type, attribute_names = []) ⇒ Blueprint
constructor
A new instance of Blueprint.
Constructor Details
#initialize(type, attribute_names = []) ⇒ Blueprint
Returns a new instance of Blueprint.
6 7 8 9 10 11 12 13 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 6 def initialize(type, attribute_names = []) @type = type @attribute_names = attribute_names @dynamic_attributes = Proc.new { [] } @parameter_filter = Proc.new do |name, value| @attribute_names.include?(name.to_s) || name == :id end end |
Instance Attribute Details
#attribute_names(object) ⇒ Object
Returns the value of attribute attribute_names.
4 5 6 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 4 def attribute_names @attribute_names end |
#dynamic_attributes ⇒ Object
Returns the value of attribute dynamic_attributes.
4 5 6 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 4 def dynamic_attributes @dynamic_attributes end |
#parameter_filter ⇒ Object
Returns the value of attribute parameter_filter.
4 5 6 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 4 def parameter_filter @parameter_filter end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 4 def type @type end |
Instance Method Details
#add_attribute(attribute_name) ⇒ Object
15 16 17 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 15 def add_attribute(attribute_name) @attribute_names << attribute_name end |
#deserialize_parameter?(name, value) ⇒ Boolean
23 24 25 |
# File 'lib/edgycircle_toolbox/sonapi/blueprint.rb', line 23 def deserialize_parameter?(name, value) parameter_filter.call(name, value) end |