Class: Titi::Matcher::MatchProc
- Inherits:
-
MatchFirstElement
- Object
- Base
- MatchFirstElement
- Titi::Matcher::MatchProc
- Defined in:
- lib/titi/ignore/matcher.rb
Overview
FIXME is there really a need for this separate class? why can’t MatchFirstElement.match accept a block?
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#proc ⇒ Object
Returns the value of attribute proc.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(selector, proc, matcher = nil, options = {}) ⇒ MatchProc
constructor
A new instance of MatchProc.
- #match(doc) ⇒ Object
Constructor Details
#initialize(selector, proc, matcher = nil, options = {}) ⇒ MatchProc
Returns a new instance of MatchProc.
57 58 59 60 61 |
# File 'lib/titi/ignore/matcher.rb', line 57 def initialize selector, proc, matcher=nil, ={} super selector, matcher self. = self.proc = proc end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
56 57 58 |
# File 'lib/titi/ignore/matcher.rb', line 56 def @options end |
#proc ⇒ Object
Returns the value of attribute proc.
55 56 57 |
# File 'lib/titi/ignore/matcher.rb', line 55 def proc @proc end |
Instance Method Details
#match(doc) ⇒ Object
62 63 64 65 |
# File 'lib/titi/ignore/matcher.rb', line 62 def match doc val = super doc val ? self.proc.call(val) : self.proc.call(doc) end |