Class: XRay::HTML::Document

Inherits:
Element
  • Object
show all
Defined in:
lib/html/struct.rb

Constant Summary

Constants inherited from Element

Element::CLASS, Element::ID, Element::PROP, Element::PROP_PAIR, Element::WORD

Instance Attribute Summary

Attributes inherited from Element

#children, #close_type, #ending, #parent, #props, #scopes, #tag

Instance Method Summary collapse

Methods inherited from Element

#auto_close?, #closed?, #each, #has_prop?, #has_scope?, #in_scope?, #inline?, #inner_html, #inner_text, #match?, #outer_html, #prop, #prop_text, #prop_value, #query, #self_closed?, #tag_name, #tag_name_equal?, #to_s

Constructor Details

#initialize(children = []) ⇒ Document

Returns a new instance of Document.



153
154
155
156
# File 'lib/html/struct.rb', line 153

def initialize( children=[] )
  super(nil, {}, children || [])
  @position = Position.new(0,0,0)
end

Instance Method Details

#==(other) ⇒ Object



158
159
160
161
162
163
164
165
166
# File 'lib/html/struct.rb', line 158

def ==(other)
  if other.is_a?(Array)
    return children == other
  elsif other.is_a?(Document)
    return children == other.children
  else
    super
  end
end

#empty?Boolean

Returns:

  • (Boolean)


168
169
170
# File 'lib/html/struct.rb', line 168

def empty?
  children.empty?
end