Method: FStrings::Parser.str2code
- Defined in:
- lib/fstrings/parser.rb
.str2code(string) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/fstrings/parser.rb', line 33 def str2code(string) scan = StringScanner.new(string) Enumerator.produce { [ scan_simple(scan).inspect, (statement2code(**scan_statement(scan)) unless scan.eos?) ] }.slice_after { scan.eos? }.first.flatten.compact.join(' + ') end |