Class: Rouge::RegexLexer::StateDSL
- Inherits:
-
Object
- Object
- Rouge::RegexLexer::StateDSL
- Defined in:
- lib/rouge/regex_lexer.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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.
77 78 79 80 81 82 83 |
# File 'lib/rouge/regex_lexer.rb', line 77 def initialize(name, &defn) @name = name @defn = defn @rules = [] @loaded = false @closed = false end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
76 77 78 |
# File 'lib/rouge/regex_lexer.rb', line 76 def name @name end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
76 77 78 |
# File 'lib/rouge/regex_lexer.rb', line 76 def rules @rules end |
Instance Method Details
#appended(&defn) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/rouge/regex_lexer.rb', line 101 def appended(&defn) parent_defn = @defn StateDSL.new(@name) do instance_eval(&parent_defn) instance_eval(&defn) end end |