Class: Atomy::Pattern::QuasiQuote

Inherits:
Atomy::Pattern show all
Defined in:
lib/atomy/pattern/quasi_quote.rb

Defined Under Namespace

Classes: Constructor, MatchWalker, Walker

Instance Attribute Summary collapse

Attributes inherited from Atomy::Pattern

#from_node

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Atomy::Pattern

#===, #inline_matches?, #target

Constructor Details

#initialize(node) ⇒ QuasiQuote

Returns a new instance of QuasiQuote.



20
21
22
# File 'lib/atomy/pattern/quasi_quote.rb', line 20

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



9
10
11
# File 'lib/atomy/pattern/quasi_quote.rb', line 9

def node
  @node
end

Class Method Details

.make(mod, node) ⇒ Object



16
17
18
# File 'lib/atomy/pattern/quasi_quote.rb', line 16

def self.make(mod, node)
  new(mod.evaluate(patterns_through(mod, node)))
end

.patterns_through(mod, node) ⇒ Object



11
12
13
14
# File 'lib/atomy/pattern/quasi_quote.rb', line 11

def self.patterns_through(mod, node)
  constructor = Constructor.new(mod)
  constructor.go(node)
end

Instance Method Details

#matches?(val) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/atomy/pattern/quasi_quote.rb', line 24

def matches?(val)
  MatchWalker.new.go(@node, val)
end