Class: Termory::OptparsrTermory

Inherits:
Object
  • Object
show all
Defined in:
lib/termory/optpare.rb

Defined Under Namespace

Classes: ScriptOptions

Constant Summary collapse

Version =
'1.0.0'
CODES =
%w[iso-2022-jp shift_jis euc-jp utf8 binary]
CODE_ALIASES =
{ "jis" => "iso-2022-jp", "sjis" => "shift_jis" }

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



81
82
83
# File 'lib/termory/optpare.rb', line 81

def options
  @options
end

#parserObject (readonly)

Returns the value of attribute parser.



81
82
83
# File 'lib/termory/optpare.rb', line 81

def parser
  @parser
end

Instance Method Details

#parse(args) ⇒ Object

Return a structure describing the options.



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/termory/optpare.rb', line 69

def parse(args)
  # The options specified on the command line will be collected in
  # *options*.
  
  @options = ScriptOptions.new
  @args = OptionParser.new do |parser|
    @options.define_options(parser)
    parser.parse!(args)
  end
  @options
end