class KPeg::MatchString
Attributes
op[R]
string[R]
total_string[R]
Public Class Methods
new(op, string)
click to toggle source
# File lib/kpeg/match.rb, line 5 def initialize(op, string) @op = op @string = string end
Public Instance Methods
explain(indent="")
click to toggle source
# File lib/kpeg/match.rb, line 12 def explain(indent="") puts "#{indent}KPeg::Match:#{object_id.to_s(16)}" puts "#{indent} op: #{@op.inspect}" puts "#{indent} string: #{@string.inspect}" end
value(obj=nil)
click to toggle source
# File lib/kpeg/match.rb, line 20 def value(obj=nil) return @string unless @op.action if obj obj.instance_exec(@string, &@op.action) else @op.action.call(@string) end end