Class: Rule::Match

Inherits:
Struct
  • Object
show all
Defined in:
lib/rdparse.rb

Overview

A rule is created through the rule method of the Parser class, like this:

rule :term do
  match(:term, '*', :dice) {|a, _, b| a * b }
  match(:term, '/', :dice) {|a, _, b| a / b }
  match(:dice)
end

Instance Attribute Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



21
22
23
# File 'lib/rdparse.rb', line 21

def block
  @block
end

#patternObject

Returns the value of attribute pattern

Returns:

  • (Object)

    the current value of pattern



21
22
23
# File 'lib/rdparse.rb', line 21

def pattern
  @pattern
end