Module: Duxml::TextRule

Included in:
TextRuleClass
Defined in:
lib/duxml/meta/grammar/rule/text_rule.rb,
lib/duxml/meta/grammar/rule/text_rule.rb

Instance Method Summary collapse

Instance Method Details

#applies_to?(change_or_pattern) ⇒ Boolean

Returns whether this rule does in fact apply.

Parameters:

Returns:

  • (Boolean)

    whether this rule does in fact apply



15
16
17
18
# File 'lib/duxml/meta/grammar/rule/text_rule.rb', line 15

def applies_to?(change_or_pattern)
  super(change_or_pattern) &&
      change_or_pattern.respond_to?(:text)
end

#qualify(change_or_pattern) ⇒ Object

applies Regexp statement to text content of this node; returns false if content has XML



21
22
23
24
25
26
27
# File 'lib/duxml/meta/grammar/rule/text_rule.rb', line 21

def qualify(change_or_pattern)
  @object = change_or_pattern
  result = pass
  super change_or_pattern unless result
  @object = nil
  result
end