Class: Rouge::RegexLexer::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/rouge/regex_lexer.rb

Overview

A rule is a tuple of a regular expression to test, and a callback to perform if the test succeeds.

See Also:

  • StateDSL#rule

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(re, callback) ⇒ Rule

Returns a new instance of Rule.



53
54
55
56
# File 'lib/rouge/regex_lexer.rb', line 53

def initialize(re, callback)
  @re = re
  @callback = callback
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



51
52
53
# File 'lib/rouge/regex_lexer.rb', line 51

def callback
  @callback
end

#reObject (readonly)

Returns the value of attribute re.



52
53
54
# File 'lib/rouge/regex_lexer.rb', line 52

def re
  @re
end

Instance Method Details

#inspectObject



58
59
60
# File 'lib/rouge/regex_lexer.rb', line 58

def inspect
  "#<Rule #{@re.inspect}>"
end