class HTML::Text
:nodoc:
A node that represents text, rather than markup.
def ==(node)
def ==(node) return false unless super content == node.content end
def find(conditions)
is either a string or a regexp, and which is interpreted as described
* if +conditions+ is a hash, it must contain a :content key that
content
* if +conditions+ is a regular expression, it must match the node's
content
* if +conditions+ is a string, it must be a substring of the node's
conditions of the following kinds:
Returns +self+ if this node meets the given conditions. Text nodes support
def find(conditions) match(conditions) && self end
def initialize(parent, line, pos, content)
Creates a new text node as a child of the given parent, with the given
def initialize(parent, line, pos, content) super(parent, line, pos) @content = content end
def match(conditions)
Returns non-+nil+ if this node meets the given conditions, or +nil+
def match(conditions) case conditions when String @content == conditions when Regexp @content =~ conditions when Hash conditions = validate_conditions(conditions) # Text nodes only have :content, :parent, :ancestor unless (conditions.keys - [:content, :parent, :ancestor]).empty? return false end match(conditions[:content]) else nil end end
def to_s
def to_s @content end