class Milkode::CLI_Grep::ArgumentParser
Attributes
arguments[R]
gotowords[R]
keywords[R]
Public Class Methods
new(arguments)
click to toggle source
# File lib/milkode/grep/cli_grep.rb, line 322 def initialize(arguments) @arguments = arguments @state = :line @keywords = [] @gotowords = [] end
Public Instance Methods
after()
click to toggle source
# File lib/milkode/grep/cli_grep.rb, line 344 def after if @arguments.first if Util.gotoline_keyword? @arguments[0] @state = :gotoline end end result = [] @arguments.each do |v| case v when ":l" @state = :line next when ":k" @state = :keyword next when ":g" @state = :gotoline @gotowords += result result = [] next end case @state when :line result << v when :keyword @keywords << v when :gotoline @gotowords << v end end @arguments = result end
prev()
click to toggle source
# File lib/milkode/grep/cli_grep.rb, line 329 def prev @arguments.map! do |v| case v when "-l" ":l" when "-k" ":k" when "-g" ":g" else v end end end