Class: XML::Digester::RulesBase
- Inherits:
-
Object
- Object
- XML::Digester::RulesBase
- 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.
Direct Known Subclasses
BlockRule, CallMethodRule, CallParamRule, LinkRule, ObjectCreateRule, SetPropertiesRule, SetPropertyRule
Instance Attribute Summary collapse
-
#digester ⇒ Object
Returns the value of attribute digester.
-
#next ⇒ Object
:nodoc:.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#prev ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#begin(namespace, name, attrs) ⇒ Object
Called at start of matching element.
-
#body(txt) ⇒ Object
Called when body text is encountered.
-
#end(namespace, name) ⇒ Object
Called at end of matching element (in reverse order of rule registration).
-
#finish ⇒ Object
Called at the end of the parse (again, in reverse order).
-
#initialize(pattern) ⇒ RulesBase
constructor
Be sure to call through to here when subclassing RulesBase.
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
#digester ⇒ Object
Returns the value of attribute digester.
40 41 42 |
# File 'lib/xml/digestr.rb', line 40 def digester @digester end |
#next ⇒ Object
:nodoc:
61 62 63 |
# File 'lib/xml/digestr.rb', line 61 def next @next end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
39 40 41 |
# File 'lib/xml/digestr.rb', line 39 def pattern @pattern end |
#prev ⇒ Object
: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 |
#finish ⇒ Object
Called at the end of the parse (again, in reverse order).
59 |
# File 'lib/xml/digestr.rb', line 59 def finish; end |