Class: Rouge::RegexLexer::State
- Inherits:
-
Object
- Object
- Rouge::RegexLexer::State
- Defined in:
- lib/rouge/lexer.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(lexer_class, name, &defn) ⇒ State
constructor
A new instance of State.
- #load! ⇒ Object
- #relative_state(state_name) ⇒ Object
- #rules ⇒ Object
Constructor Details
#initialize(lexer_class, name, &defn) ⇒ State
Returns a new instance of State.
211 212 213 214 215 |
# File 'lib/rouge/lexer.rb', line 211 def initialize(lexer_class, name, &defn) @lexer_class = lexer_class @name = name @defn = defn end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
210 211 212 |
# File 'lib/rouge/lexer.rb', line 210 def name @name end |
Instance Method Details
#load! ⇒ Object
225 226 227 228 229 230 |
# File 'lib/rouge/lexer.rb', line 225 def load! return self if @loaded @loaded = true StateDSL.new(rules).instance_eval(&@defn) self end |
#relative_state(state_name) ⇒ Object
217 218 219 |
# File 'lib/rouge/lexer.rb', line 217 def relative_state(state_name) @lexer_class.get_state(state_name) end |
#rules ⇒ Object
221 222 223 |
# File 'lib/rouge/lexer.rb', line 221 def rules @rules ||= [] end |