Class: SDM::Tag
- Inherits:
-
Object
- Object
- SDM::Tag
- Defined in:
- lib/models/porcelain.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name: nil, value: nil) ⇒ Tag
constructor
A new instance of Tag.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(name: nil, value: nil) ⇒ Tag
Returns a new instance of Tag.
123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/models/porcelain.rb', line 123 def initialize( name: nil, value: nil ) if name != nil @name = name end if value != nil @value = value end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
119 120 121 |
# File 'lib/models/porcelain.rb', line 119 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
121 122 123 |
# File 'lib/models/porcelain.rb', line 121 def value @value end |
Instance Method Details
#to_json(options = {}) ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/models/porcelain.rb', line 135 def to_json( = {}) hash = {} self.instance_variables.each do |var| hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var end hash.to_json end |