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.



7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
# File 'lib/models/porcelain.rb', line 7423

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.



7419
7420
7421
# File 'lib/models/porcelain.rb', line 7419

def name
  @name
end

#valueObject

Returns the value of attribute value.



7421
7422
7423
# File 'lib/models/porcelain.rb', line 7421

def value
  @value
end

Instance Method Details

#to_json(options = {}) ⇒ Object



7435
7436
7437
7438
7439
7440
7441
# File 'lib/models/porcelain.rb', line 7435

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