Class: EewJpNotify::CLI::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/eew_jp_notify/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Params

Returns a new instance of Params.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/eew_jp_notify/cli.rb', line 7

def initialize(args)
  opt = OptionParser.new
  opt.on('-u user') { |v| @user = v }
  opt.on('-p password') { |v| @password = v }
  opt.on('-h') { @help_mode = true }
  opt.parse! args
  @config = {}
  @config[:user] = @user if @user
  @config[:password] = @password if @password
  @config[:help_mode] = true if @help_mode
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



18
19
20
# File 'lib/eew_jp_notify/cli.rb', line 18

def config
  @config
end