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.



47
48
49
# File 'lib/shhh/app/commands/command.rb', line 47

def initialize(application)
  self.application = application
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



45
46
47
# File 'lib/shhh/app/commands/command.rb', line 45

def application
  @application
end

Instance Method Details

#executeObject



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

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

#keyObject



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

def key
  @key ||= application.key
end

#optsObject



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

def opts
  application.opts
end

#opts_hashObject



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

def opts_hash
  application.opts_hash
end

#to_sObject



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

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