class Patme::Arguments::Optional

Public Class Methods

new(default_value) click to toggle source
# File lib/patme/arguments/optional.rb, line 4
def initialize(default_value)
  @default_value = default_value
end

Public Instance Methods

==(other) click to toggle source
# File lib/patme/arguments/optional.rb, line 13
def ==(other)
  true
end
any?() click to toggle source
# File lib/patme/arguments/optional.rb, line 17
def any?; false; end
get_value(*given) click to toggle source

*given is an array to distinguish cases with no value or nil

# File lib/patme/arguments/optional.rb, line 9
def get_value(*given)
  given.size == 1 ? given.first : @default_value
end
optional?() click to toggle source
# File lib/patme/arguments/optional.rb, line 18
def optional?; true; end
specific?() click to toggle source
# File lib/patme/arguments/optional.rb, line 19
def specific?; false; end