Class: JSONCop::Model::Model
- Inherits:
-
Object
- Object
- JSONCop::Model::Model
- Defined in:
- lib/jsoncop/model/model.rb
Instance Attribute Summary collapse
-
#attr_json_hash ⇒ Object
Returns the value of attribute attr_json_hash.
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#transformers ⇒ Object
Returns the value of attribute transformers.
Instance Method Summary collapse
-
#initialize(name) ⇒ Model
constructor
A new instance of Model.
- #key_value_pair ⇒ Object
Constructor Details
#initialize(name) ⇒ Model
Returns a new instance of Model.
9 10 11 12 13 14 |
# File 'lib/jsoncop/model/model.rb', line 9 def initialize(name) @name = name.gsub(/\s+/, "") @attributes = [] @transformers = [] @attr_json_hash = {} end |
Instance Attribute Details
#attr_json_hash ⇒ Object
Returns the value of attribute attr_json_hash.
7 8 9 |
# File 'lib/jsoncop/model/model.rb', line 7 def attr_json_hash @attr_json_hash end |
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/jsoncop/model/model.rb', line 5 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/jsoncop/model/model.rb', line 4 def name @name end |
#transformers ⇒ Object
Returns the value of attribute transformers.
6 7 8 |
# File 'lib/jsoncop/model/model.rb', line 6 def transformers @transformers end |
Instance Method Details
#key_value_pair ⇒ Object
16 17 18 |
# File 'lib/jsoncop/model/model.rb', line 16 def key_value_pair attributes.map { |attribute| "#{attribute.name}: #{attribute.name}" }.join(", ") end |