Class: Owrb::HTML::Element

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Element

Returns a new instance of Element.



43
44
45
46
47
48
49
50
51
# File 'lib/owrb.rb', line 43

def initialize( element )
  @element = element
  @name = element.name
  @attributes = {}
  element.attributes.each{|name, attribute|
    @attributes[ attribute.name ] = attribute.value
  }
  @inner_html = element.inner_html
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



41
42
43
# File 'lib/owrb.rb', line 41

def attributes
  @attributes
end

#elementObject (readonly)

Returns the value of attribute element.



41
42
43
# File 'lib/owrb.rb', line 41

def element
  @element
end

#inner_htmlObject (readonly)

Returns the value of attribute inner_html.



41
42
43
# File 'lib/owrb.rb', line 41

def inner_html
  @inner_html
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/owrb.rb', line 41

def name
  @name
end

Instance Method Details

#to_hObject



53
54
55
56
57
58
59
# File 'lib/owrb.rb', line 53

def to_h
  {
    :name       => @name,
    :attributes => @attributes,
    :inner_html => @inner_html,
  }
end