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.
45 46 47 48 49 |
# File 'lib/rouge/regex_lexer.rb', line 45 def initialize(name, &defn) @name = name @defn = defn @rules = [] end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
44 45 46 |
# File 'lib/rouge/regex_lexer.rb', line 44 def rules @rules end |
Instance Method Details
#appended(&defn) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/rouge/regex_lexer.rb', line 67 def appended(&defn) parent_defn = @defn StateDSL.new(@name) do instance_eval(&parent_defn) instance_eval(&defn) end end |