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

Constructor Details

#initialize(obj) ⇒ Obj

Returns a new instance of Obj.



292
293
294
# File 'lib/patm.rb', line 292

def initialize(obj)
  @obj = obj
end

Instance Method Details

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



304
305
306
307
308
309
310
311
# File 'lib/patm.rb', line 304

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



296
297
298
# File 'lib/patm.rb', line 296

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

#inspectObject



300
301
302
# File 'lib/patm.rb', line 300

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