Class: CloudFormer::PropertyOrAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_former/property_or_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ PropertyOrAttribute

Returns a new instance of PropertyOrAttribute.



7
8
9
10
# File 'lib/cloud_former/property_or_attribute.rb', line 7

def initialize(name, options)
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/cloud_former/property_or_attribute.rb', line 4

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/cloud_former/property_or_attribute.rb', line 5

def options
  @options
end

Instance Method Details

#as_json_for(instance) ⇒ Object



12
13
14
# File 'lib/cloud_former/property_or_attribute.rb', line 12

def as_json_for(instance)
  val_as_json(instance.send(name))
end