Class: Luban::CLI::Option

Inherits:
Argument show all
Defined in:
lib/luban/cli/base/option.rb

Direct Known Subclasses

NullableOption, Switch

Instance Attribute Summary

Attributes inherited from Argument

#description, #display_name, #name, #value

Instance Method Summary collapse

Methods inherited from Argument

#[], #assured?, #default_type, #has_default?, #initialize, #kind, #match?, #missing?, #multiple?, #optional?, #required?, #reset, #valid?, #validate, #within?

Constructor Details

This class inherits a constructor from Luban::CLI::Argument

Instance Method Details

#default_imperativeObject



12
# File 'lib/luban/cli/base/option.rb', line 12

def default_imperative; false; end

#default_strObject



14
15
16
# File 'lib/luban/cli/base/option.rb', line 14

def default_str
  @default_str ||= has_default? ? build_default_str : ''
end

#specsObject



4
5
6
7
8
9
10
# File 'lib/luban/cli/base/option.rb', line 4

def specs
  specs = [ description ]
  specs << build_long_option
  specs << build_short_option if @config.has_key?(:short)
  specs << Array if multiple?
  specs
end