Module: Option

Included in:
CommandParser
Defined in:
lib/dotfiles/parse/parser.rb

Overview

File: parser.rb Project: dotfiles-cli Author: exstnce ([email protected]) Created on Monday, 9th July 2018 3:32:36 pm

Class Method Summary collapse

Class Method Details

.on(arg) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/dotfiles/parse/parser.rb', line 27

def self.on(arg)
  if arg == ARGV[0].downcase
    if ARGV.length >= 2 && !ARGV[1].strip.empty?
      yield ARGV[1].strip
    else
      yield
    end
  end
end

.on_emptyObject



21
22
23
24
25
# File 'lib/dotfiles/parse/parser.rb', line 21

def self.on_empty
  if ARGV.empty?
    yield
  end
end