class Patm::Pattern::Named
Attributes
index[R]
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/patm.rb, line 418 def initialize(name) raise ::ArgumentError unless name.is_a?(Symbol) || name.is_a?(Numeric) @name = name end
Public Instance Methods
compile_internal(free_index, target_name = "_obj")
click to toggle source
# File lib/patm.rb, line 429 def compile_internal(free_index, target_name = "_obj") [ "_match[#{@name.inspect}] = #{target_name}; true", [], free_index ] end
execute(match, obj)
click to toggle source
# File lib/patm.rb, line 424 def execute(match, obj) match[@name] = obj true end
inspect()
click to toggle source
# File lib/patm.rb, line 428 def inspect; "NAMED(#{@name})"; end