Class: XRay::HTML::DTDElement

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 collapse

Attributes inherited from Element

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

Instance Method Summary collapse

Methods inherited from Element

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

Constructor Details

#initialize(type, pre = "DOCTYPE", pos = nil) ⇒ DTDElement

Returns a new instance of DTDElement.



239
240
241
242
# File 'lib/html/struct.rb', line 239

def initialize(type, pre="DOCTYPE", pos=nil)
  @type, @pre = type, pre
  @position   = pos || Position.new(0,0,0)
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



237
238
239
# File 'lib/html/struct.rb', line 237

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



254
255
256
# File 'lib/html/struct.rb', line 254

def ==(other)
  other.is_a?(DTDElement) and other.type == type
end

#=~(other) ⇒ Object



258
259
260
# File 'lib/html/struct.rb', line 258

def =~(other)
  to_s =~ other
end

#inline?Boolean

Returns:

  • (Boolean)


248
249
250
# File 'lib/html/struct.rb', line 248

def inline?
  true
end

#to_sObject Also known as: outer_html



244
245
246
# File 'lib/html/struct.rb', line 244

def to_s
  "<!#{@pre} #{type}>"
end