Class: Rouge::RegexLexer::Rule
- Inherits:
-
Object
- Object
- Rouge::RegexLexer::Rule
- 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.
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#re ⇒ Object
readonly
Returns the value of attribute re.
Instance Method Summary collapse
-
#initialize(re, callback) ⇒ Rule
constructor
A new instance of Rule.
- #inspect ⇒ Object
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
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
51 52 53 |
# File 'lib/rouge/regex_lexer.rb', line 51 def callback @callback end |
#re ⇒ Object (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
#inspect ⇒ Object
58 59 60 |
# File 'lib/rouge/regex_lexer.rb', line 58 def inspect "#<Rule #{@re.inspect}>" end |