Class: RailroadDiagrams::Builder
- Inherits:
-
Object
- Object
- RailroadDiagrams::Builder
- Includes:
- DSL
- Defined in:
- lib/railroad_diagrams/builder.rb
Overview
Executes DSL expressions with configurable value coercion.
Instance Attribute Summary collapse
-
#coercion ⇒ Object
readonly
Returns the value of attribute coercion.
Instance Method Summary collapse
-
#initialize(coerce: nil) ⇒ Builder
constructor
A new instance of Builder.
Methods included from DSL
#alt, #block, #char_class, #choice, #comment, #diagram, #except, #group, #hchoice, #list, #mchoice, #nt, #one_or_more, #opt, #oseq, #repeat, #seq, #skip, #special, #stack, #t, #zero_or_more
Constructor Details
#initialize(coerce: nil) ⇒ Builder
Returns a new instance of Builder.
192 193 194 195 196 197 198 |
# File 'lib/railroad_diagrams/builder.rb', line 192 def initialize(coerce: nil) @coercion = if coerce.nil? && RailroadDiagrams..respond_to?(:coerce) RailroadDiagrams..coerce else coerce end end |
Instance Attribute Details
#coercion ⇒ Object (readonly)
Returns the value of attribute coercion.
190 191 192 |
# File 'lib/railroad_diagrams/builder.rb', line 190 def coercion @coercion end |