Class: Patm::Pattern::Obj

Inherits:
Patm::Pattern show all
Defined in:
lib/patm.rb

Instance Method Summary collapse

Methods inherited from Patm::Pattern

#&, build_from, #compile, #rest?

Constructor Details

#initialize(obj) ⇒ Obj

Returns a new instance of Obj.



161
162
163
# File 'lib/patm.rb', line 161

def initialize(obj)
  @obj = obj
end

Instance Method Details

#compile_internal(free_index, target_name = "_obj") ⇒ Object



173
174
175
176
177
178
179
# File 'lib/patm.rb', line 173

def compile_internal(free_index, target_name = "_obj")
  [
    "_ctx[#{free_index}] === #{target_name}",
    [@obj],
    free_index + 1,
  ]
end

#execute(mmatch, obj) ⇒ Object



165
166
167
# File 'lib/patm.rb', line 165

def execute(mmatch, obj)
  @obj === obj
end

#inspectObject



169
170
171
# File 'lib/patm.rb', line 169

def inspect
  "OBJ(#{@obj.inspect})"
end