Exception: Zedkit::CLI::CommandLineError

Inherits:
ZedkitError
  • Object
show all
Defined in:
lib/zedkit/cli/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info = {}) ⇒ CommandLineError

Returns a new instance of CommandLineError.



23
24
25
26
# File 'lib/zedkit/cli/exceptions.rb', line 23

def initialize(info = {})
  @locale  = info[:locale]  || :en
  @message = info[:message] || nil
end

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale.



21
22
23
# File 'lib/zedkit/cli/exceptions.rb', line 21

def locale
  @locale
end

#messageObject (readonly)

Returns the value of attribute message.



21
22
23
# File 'lib/zedkit/cli/exceptions.rb', line 21

def message
  @message
end

Instance Method Details

#to_sObject



28
29
30
31
# File 'lib/zedkit/cli/exceptions.rb', line 28

def to_s
  rs  = "\n" << Zedkit::CLI.ee(locale, :general, :error) << "\n"
  rs << "  #{Zedkit::CLI.ee(locale, :general, :message)} => #{message}.\n\n" unless message.nil?
end