Class: Atomy::Pattern
- Inherits:
-
Object
show all
- Defined in:
- lib/atomy/pattern.rb,
lib/atomy/pattern/or.rb,
lib/atomy/pattern/and.rb,
lib/atomy/pattern/splat.rb,
lib/atomy/pattern/kind_of.rb,
lib/atomy/pattern/equality.rb,
lib/atomy/pattern/wildcard.rb,
lib/atomy/pattern/attribute.rb,
lib/atomy/pattern/quasi_quote.rb,
lib/atomy/pattern/class_variable.rb,
lib/atomy/pattern/instance_variable.rb
Defined Under Namespace
Classes: And, Attribute, ClassVariable, Equality, InstanceVariable, KindOf, Or, QuasiQuote, Splat, Wildcard
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#from_node ⇒ Object
Returns the value of attribute from_node.
6
7
8
|
# File 'lib/atomy/pattern.rb', line 6
def from_node
@from_node
end
|
Instance Method Details
8
9
10
|
# File 'lib/atomy/pattern.rb', line 8
def ===(v)
matches?(v)
end
|
#inline_matches?(gen) ⇒ Boolean
20
21
22
23
24
|
# File 'lib/atomy/pattern.rb', line 20
def inline_matches?(gen)
gen.push_literal(self)
gen.swap
gen.send(:matches?, 1)
end
|
#matches?(gen) ⇒ Boolean
12
13
14
|
# File 'lib/atomy/pattern.rb', line 12
def matches?(gen)
raise NotImplementedError
end
|
16
17
18
|
# File 'lib/atomy/pattern.rb', line 16
def target
raise NotImplementedError
end
|