Class: Patm::Pattern::Opt

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

Constructor Details

#initialize(pat) ⇒ Opt

Returns a new instance of Opt.



188
189
190
# File 'lib/patm.rb', line 188

def initialize(pat)
  @pat = pat
end

Instance Method Details

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



198
199
200
# File 'lib/patm.rb', line 198

def compile_internal(free_index, target_name = "_obj")
  @pat.compile_internal(free_index, target_name)
end

#execute(match, obj) ⇒ Object



194
195
196
# File 'lib/patm.rb', line 194

def execute(match, obj)
  @pat.execute(match, obj)
end

#inspectObject



197
# File 'lib/patm.rb', line 197

def inspect; "?#{@pat.inspect}"; end

#opt?Boolean

Returns:

  • (Boolean)


191
192
193
# File 'lib/patm.rb', line 191

def opt?
  true
end