Class: Rouge::RegexLexer::StateDSL
- Inherits:
-
Object
- Object
- Rouge::RegexLexer::StateDSL
- Defined in:
- lib/rouge/regex_lexer.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #appended(&defn) ⇒ Object
-
#initialize(name, &defn) ⇒ StateDSL
constructor
A new instance of StateDSL.
- #prepended(&defn) ⇒ Object
- #to_state(lexer_class) ⇒ Object
Constructor Details
#initialize(name, &defn) ⇒ StateDSL
Returns a new instance of StateDSL.
51 52 53 54 55 |
# File 'lib/rouge/regex_lexer.rb', line 51 def initialize(name, &defn) @name = name @defn = defn @rules = [] end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
50 51 52 |
# File 'lib/rouge/regex_lexer.rb', line 50 def rules @rules end |
Instance Method Details
#appended(&defn) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/rouge/regex_lexer.rb', line 73 def appended(&defn) parent_defn = @defn StateDSL.new(@name) do instance_eval(&parent_defn) instance_eval(&defn) end end |