Class: SDM::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, value: nil) ⇒ Tag

Returns a new instance of Tag.



7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
# File 'lib/models/porcelain.rb', line 7467

def initialize(
  name: nil,
  value: nil
)
  if name != nil
    @name = name
  end
  if value != nil
    @value = value
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



7463
7464
7465
# File 'lib/models/porcelain.rb', line 7463

def name
  @name
end

#valueObject

Returns the value of attribute value.



7465
7466
7467
# File 'lib/models/porcelain.rb', line 7465

def value
  @value
end

Instance Method Details

#to_json(options = {}) ⇒ Object



7479
7480
7481
7482
7483
7484
7485
# File 'lib/models/porcelain.rb', line 7479

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end