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.
-
#is_struct ⇒ Object
Returns the value of attribute is_struct.
-
#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.
10 11 12 13 14 15 |
# File 'lib/jsoncop/model/model.rb', line 10 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.
8 9 10 |
# File 'lib/jsoncop/model/model.rb', line 8 def attr_json_hash @attr_json_hash end |
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/jsoncop/model/model.rb', line 6 def attributes @attributes end |
#is_struct ⇒ Object
Returns the value of attribute is_struct.
5 6 7 |
# File 'lib/jsoncop/model/model.rb', line 5 def is_struct @is_struct 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.
7 8 9 |
# File 'lib/jsoncop/model/model.rb', line 7 def transformers @transformers end |
Instance Method Details
#key_value_pair ⇒ Object
17 18 19 |
# File 'lib/jsoncop/model/model.rb', line 17 def key_value_pair attributes.map { |attribute| "#{attribute.name}: #{attribute.name}" }.join(", ") end |