Class: Attribute

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute) ⇒ Attribute

Returns a new instance of Attribute.



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

def initialize(attribute)
  @name = attribute['name']
  @type = attribute['type']
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.allObject



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

def self.all
  ObjectSpace.each_object(self).to_a
end

Instance Method Details

#add_to(command) ⇒ Object



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

def add_to(command)
  command << " #{name}:#{type}"
end