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.



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

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



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

def action
  @action
end

Instance Method Details

#==(obj) ⇒ Object



560
561
562
563
564
565
566
567
# File 'lib/kpeg/grammar.rb', line 560

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

#inspectObject



569
570
571
# File 'lib/kpeg/grammar.rb', line 569

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

#match(x) ⇒ Object



556
557
558
# File 'lib/kpeg/grammar.rb', line 556

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