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, build_from_array, build_from_hash, #compile, #opt, #opt?, #rest?

Constructor Details

#initialize(obj) ⇒ Obj

Returns a new instance of Obj.



319
320
321
# File 'lib/patm.rb', line 319

def initialize(obj)
  @obj = obj
end

Instance Method Details

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



331
332
333
334
335
336
337
338
# File 'lib/patm.rb', line 331

def compile_internal(free_index, target_name = "_obj")
  val_src, c, i = Util.compile_value(@obj, free_index)
  [
    "#{val_src} === #{target_name}",
    c,
    i
  ]
end

#execute(mmatch, obj) ⇒ Object



323
324
325
# File 'lib/patm.rb', line 323

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

#inspectObject



327
328
329
# File 'lib/patm.rb', line 327

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