Class: Furnace::AST::MatcherSpecial

Inherits:
Object
  • Object
show all
Defined in:
lib/furnace/ast/matcher/special.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, param = nil) ⇒ MatcherSpecial

Returns a new instance of MatcherSpecial.



5
6
7
# File 'lib/furnace/ast/matcher/special.rb', line 5

def initialize(type, param=nil)
  @type, @param = type, param
end

Instance Attribute Details

#paramObject (readonly)

Returns the value of attribute param.



3
4
5
# File 'lib/furnace/ast/matcher/special.rb', line 3

def param
  @param
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/furnace/ast/matcher/special.rb', line 3

def type
  @type
end

Class Method Details

.define(type) ⇒ Object



10
11
12
# File 'lib/furnace/ast/matcher/special.rb', line 10

def define(type)
  lambda { |*args| new(type, args) }
end

.kind(type) ⇒ Object



14
15
16
17
# File 'lib/furnace/ast/matcher/special.rb', line 14

def kind(type)
  @kind_lambdas       ||= {}
  @kind_lambdas[type] ||= lambda { |m| m.is_a?(MatcherSpecial) && m.type == type }
end