class Eco::CLI::Scripting::Argument
Attributes
key[R]
Public Class Methods
is_modifier?(value)
click to toggle source
# File lib/eco/cli/scripting/argument.rb, line 9 def is_modifier?(value) value&.start_with?("-") end
new(key, with_param: false)
click to toggle source
# File lib/eco/cli/scripting/argument.rb, line 14 def initialize(key, with_param: false) @key = key @with_param = !!with_param end
Public Instance Methods
args_slice(*args)
click to toggle source
# File lib/eco/cli/scripting/argument.rb, line 19 def args_slice(*args) #pp "known arg '#{key}' => included? #{args.include?(key)}" return args unless args.include?(key) i = args.index(key) j = with_param?? i+1 : i args - args.slice(i..j) end
with_param!()
click to toggle source
# File lib/eco/cli/scripting/argument.rb, line 27 def with_param! @with_param = true end
with_param?()
click to toggle source
# File lib/eco/cli/scripting/argument.rb, line 31 def with_param? @with_param end