Class: L43::OptParser::Keyword

Inherits:
Object
  • Object
show all
Extended by:
L43::OpenObject
Defined in:
lib/l43/opt_parser/keyword.rb

Constant Summary collapse

Result =
Core::Result

Instance Method Summary collapse

Instance Method Details

#check_value(value, keywords) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/l43/opt_parser/keyword.rb', line 33

def check_value(value, keywords)
  if keywords.has_key?(real_name) && !multiple
    return Result.error("must not assign multiple values to keyword :#{name}")
  end

  check_set(value).if_error { return it }

  value = init.(value) if init
  Result.ok(value)
end

#real_nameObject



44
# File 'lib/l43/opt_parser/keyword.rb', line 44

def real_name = as || name