Class: Mapricot::Attribute

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type) ⇒ Attribute

Returns a new instance of Attribute.



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

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#set_value_from_node(node) ⇒ Object



10
11
12
13
# File 'lib/mapricot/attribute.rb', line 10

def set_value_from_node(node)
  @value = node.attributes[name.to_s]
  typecast
end