Class: Shhh::App::Commands::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/shhh/app/commands/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ Command

Returns a new instance of Command.



51
52
53
# File 'lib/shhh/app/commands/command.rb', line 51

def initialize(application)
  self.application = application
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



49
50
51
# File 'lib/shhh/app/commands/command.rb', line 49

def application
  @application
end

Instance Method Details

#executeObject



66
67
68
# File 'lib/shhh/app/commands/command.rb', line 66

def execute
  raise Shhh::Errors::AbstractMethodCalled.new(:run)
end

#keyObject



62
63
64
# File 'lib/shhh/app/commands/command.rb', line 62

def key
  @key ||= application.key
end

#optsObject



55
56
57
# File 'lib/shhh/app/commands/command.rb', line 55

def opts
  application.opts
end

#opts_hashObject



58
59
60
# File 'lib/shhh/app/commands/command.rb', line 58

def opts_hash
  application.opts_hash
end

#to_sObject



70
71
72
# File 'lib/shhh/app/commands/command.rb', line 70

def to_s
  "#{self.class.short_name.to_s.bold.yellow}, with options: #{application.args.argv.join(' ').gsub(/--/, '').bold.green}"
end