Class: CommandLineSlicer
- Inherits:
-
Object
- Object
- CommandLineSlicer
- Defined in:
- lib/lucie/command_line_slicer.rb
Instance Method Summary collapse
-
#initialize(line) ⇒ CommandLineSlicer
constructor
A new instance of CommandLineSlicer.
- #to_a ⇒ Object
Constructor Details
#initialize(line) ⇒ CommandLineSlicer
Returns a new instance of CommandLineSlicer.
2 3 4 5 6 7 8 |
# File 'lib/lucie/command_line_slicer.rb', line 2 def initialize(line) @line = line.split("") @parts = [] @neutral_status = false @quotation_open = false @scanned = "" end |
Instance Method Details
#to_a ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lucie/command_line_slicer.rb', line 10 def to_a each_char do |char| if boundary? char save_chunk elsif in_quoatation? char toggle_quotation_state elsif neutral? char neutral :on else neutral :off append char end end save_chunk end |