An abstract class for filter components. Subclass and override #to_s to implement a custom Component class.
Inherited hook: re-expose inheriting class's .new method
# File lib/treequel/filter.rb, line 84 def self::inherited( klass ) klass.module_eval( 'public_class_method :new' ) super end
Return a human-readable string representation of the component suitable for debugging.
# File lib/treequel/filter.rb, line 101 def inspect return %Q{#<%s:0x%0x "%s">} % [ self.class.name, self.object_id * 2, self.to_s, ] end
Components are non-promiscuous (don't match everything) by default.
# File lib/treequel/filter.rb, line 110 def promiscuous? return false end
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.
# File lib/treequel/filter.rb, line 93 def to_s raise NotImplementedError, "%s does not provide an implementation of #to_s" % [ self.class.name ] end