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.



559
560
561
562
# File 'lib/kpeg/grammar.rb', line 559

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



564
565
566
# File 'lib/kpeg/grammar.rb', line 564

def action
  @action
end

Instance Method Details

#==(obj) ⇒ Object



570
571
572
573
574
575
576
577
# File 'lib/kpeg/grammar.rb', line 570

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

#inspectObject



579
580
581
# File 'lib/kpeg/grammar.rb', line 579

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

#match(x) ⇒ Object



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

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