Class: SexpPath::Matcher::Block

Inherits:
Base
  • Object
show all
Defined in:
lib/sexp_path/matcher/block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#&, #-@, #>>, #|

Methods included from Traverse

#capture_as, #replace_sexp, #search, #search_each

Constructor Details

#initialize(&block) ⇒ Block

Returns a new instance of Block.



3
4
5
# File 'lib/sexp_path/matcher/block.rb', line 3

def initialize &block
  @exp = block
end

Instance Attribute Details

#expObject (readonly)

Returns the value of attribute exp.



2
3
4
# File 'lib/sexp_path/matcher/block.rb', line 2

def exp
  @exp
end

Instance Method Details

#inspectObject



13
14
15
# File 'lib/sexp_path/matcher/block.rb', line 13

def inspect
  "<custom>"
end

#satisfy?(o, data = {}) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/sexp_path/matcher/block.rb', line 7

def satisfy?(o, data={})
  return nil unless @exp[o]

  capture_match o, data
end