class LicenseAcceptance::Strategy::Argument

Look for acceptance values in the ARGV

Constants

FLAG

Attributes

argv[R]

Public Class Methods

new(argv) click to toggle source
# File lib/license_acceptance/strategy/argument.rb, line 13
def initialize(argv)
  @argv = argv
end

Public Instance Methods

accepted?() click to toggle source
# File lib/license_acceptance/strategy/argument.rb, line 17
def accepted?
  String(value).downcase == ACCEPT
end
no_persist?() click to toggle source
# File lib/license_acceptance/strategy/argument.rb, line 25
def no_persist?
  String(value).downcase == ACCEPT_NO_PERSIST
end
silent?() click to toggle source
# File lib/license_acceptance/strategy/argument.rb, line 21
def silent?
  String(value).downcase == ACCEPT_SILENT
end
value() click to toggle source
# File lib/license_acceptance/strategy/argument.rb, line 33
def value
  match = argv.detect { |s| s.start_with?("#{FLAG}=") }
  return match.split("=").last if match

  argv.each_cons(2) do |arg, value|
    return value if arg == FLAG
  end

  nil
end
value?() click to toggle source
# File lib/license_acceptance/strategy/argument.rb, line 29
def value?
  argv.any? { |s| s == FLAG || s.start_with?("#{FLAG}=") }
end