Class: XRay::HTML::TextElement

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

#each, #empty?, #has_prop?, #has_scope?, #in_scope?, #match?, #prop, #prop_text, #prop_value, #query, #self_closed?

Constructor Details

#initialize(text = "") ⇒ TextElement

Returns a new instance of TextElement.



176
177
178
179
# File 'lib/html/struct.rb', line 176

def initialize(text="")
  super(nil)
  @text = text.to_s
end

Instance Method Details

#==(other) ⇒ Object



188
189
190
# File 'lib/html/struct.rb', line 188

def ==(other)
  text == other.text
end

#auto_close?Boolean

Returns:

  • (Boolean)


194
# File 'lib/html/struct.rb', line 194

def auto_close? ; false; end

#closed?Boolean

Returns:

  • (Boolean)


195
# File 'lib/html/struct.rb', line 195

def closed? ; true; end

#inline?Boolean

Returns:

  • (Boolean)


193
# File 'lib/html/struct.rb', line 193

def inline?; true; end

#tag_nameObject



182
# File 'lib/html/struct.rb', line 182

def tag_name; nil; end

#tag_name_equal?(name) ⇒ Boolean

Returns:

  • (Boolean)


192
# File 'lib/html/struct.rb', line 192

def tag_name_equal?(name); false; end

#textObject Also known as: inner_text, inner_html, outer_html



181
# File 'lib/html/struct.rb', line 181

def text; @text; end

#to_sObject



197
198
199
# File 'lib/html/struct.rb', line 197

def to_s
  "[TEXT: #{text}]"
end