Class: Treequel::Filter::Component
- Inherits:
-
Object
- Object
- Treequel::Filter::Component
- Extended by:
- Loggability
- Defined in:
- lib/treequel/filter.rb
Overview
An abstract class for filter components. Subclass and override #to_s to implement a custom Component class.
Direct Known Subclasses
Class Method Summary collapse
-
.inherited(klass) ⇒ Object
Inherited hook: re-expose inheriting class’s .new method.
Instance Method Summary collapse
-
#inspect ⇒ Object
Return a human-readable string representation of the component suitable for debugging.
-
#promiscuous? ⇒ Boolean
Components are non-promiscuous (don’t match everything) by default.
-
#to_s ⇒ Object
Stringify the component.
Class Method Details
.inherited(klass) ⇒ Object
Inherited hook: re-expose inheriting class’s .new method
97 98 99 100 |
# File 'lib/treequel/filter.rb', line 97 def self::inherited( klass ) klass.module_eval( 'public_class_method :new' ) super end |
Instance Method Details
#inspect ⇒ Object
Return a human-readable string representation of the component suitable for debugging.
114 115 116 117 118 119 120 |
# File 'lib/treequel/filter.rb', line 114 def inspect return %Q{#<%s:0x%0x "%s">} % [ self.class.name, self.object_id * 2, self.to_s, ] end |
#promiscuous? ⇒ Boolean
Components are non-promiscuous (don’t match everything) by default.
123 124 125 |
# File 'lib/treequel/filter.rb', line 123 def promiscuous? return false end |
#to_s ⇒ Object
Stringify the component. :TODO: If this doesn’t end up being a refactored version of all of its subclasses’s #to_s methods, test that it needs overriding.
106 107 108 109 |
# File 'lib/treequel/filter.rb', line 106 def to_s raise NotImplementedError, "%s does not provide an implementation of #to_s" % [ self.class.name ] end |