Class: CfScript::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/cf_script/object/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ Attribute

Returns a new instance of Attribute.



4
5
6
7
# File 'lib/cf_script/object/attribute.rb', line 4

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/cf_script/object/attribute.rb', line 2

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



2
3
4
# File 'lib/cf_script/object/attribute.rb', line 2

def value
  @value
end

Instance Method Details

#to_aObject



9
10
11
# File 'lib/cf_script/object/attribute.rb', line 9

def to_a
  value ? value.split(/,\s*/) : []
end

#to_sObject Also known as: inspect



13
14
15
# File 'lib/cf_script/object/attribute.rb', line 13

def to_s
  "#{name}: #{value}"
end