Class: KPeg::Action

Inherits:
Operator show all
Defined in:
lib/kpeg/grammar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Operator

#detect_tags, #inspect_type, #prune_values, #set_action, #|

Constructor Details

#initialize(action) ⇒ Action

Returns a new instance of Action.



546
547
548
549
# File 'lib/kpeg/grammar.rb', line 546

def initialize(action)
  super()
  @action = action
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



551
552
553
# File 'lib/kpeg/grammar.rb', line 551

def action
  @action
end

Instance Method Details

#==(obj) ⇒ Object



557
558
559
560
561
562
563
564
# File 'lib/kpeg/grammar.rb', line 557

def ==(obj)
  case obj
  when Action
    @action == obj.action
  else
    super
  end
end

#inspectObject



566
567
568
# File 'lib/kpeg/grammar.rb', line 566

def inspect
  inspect_type "action", "=> #{action.inspect}"
end

#match(x) ⇒ Object



553
554
555
# File 'lib/kpeg/grammar.rb', line 553

def match(x)
  return MatchString.new(self, "")
end