Class: XML::Digester::RulesBase

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/digestr.rb

Overview

Base-class for rule implementations. This class implements the standard (currently fnmatch-based) pattern matching logic and can be used as a base-class for custom rule implementations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ RulesBase

Be sure to call through to here when subclassing RulesBase.



43
44
45
46
# File 'lib/xml/digestr.rb', line 43

def initialize(pattern)
  @pattern = pattern or raise ArgumentError, "No pattern given"
  @pattern = '/' + @pattern unless @pattern[0] == ?/
end

Instance Attribute Details

#digesterObject

Returns the value of attribute digester.



40
41
42
# File 'lib/xml/digestr.rb', line 40

def digester
  @digester
end

#nextObject

:nodoc:



61
62
63
# File 'lib/xml/digestr.rb', line 61

def next
  @next
end

#patternObject (readonly)

Returns the value of attribute pattern.



39
40
41
# File 'lib/xml/digestr.rb', line 39

def pattern
  @pattern
end

#prevObject

:nodoc:



61
62
63
# File 'lib/xml/digestr.rb', line 61

def prev
  @prev
end

Instance Method Details

#begin(namespace, name, attrs) ⇒ Object

Called at start of matching element.



49
# File 'lib/xml/digestr.rb', line 49

def begin(namespace, name, attrs); end

#body(txt) ⇒ Object

Called when body text is encountered.



52
# File 'lib/xml/digestr.rb', line 52

def body(txt); end

#end(namespace, name) ⇒ Object

Called at end of matching element (in reverse order of rule registration).



56
# File 'lib/xml/digestr.rb', line 56

def end(namespace, name); end

#finishObject

Called at the end of the parse (again, in reverse order).



59
# File 'lib/xml/digestr.rb', line 59

def finish; end