Class: Kozo::Commands::State::Show

Inherits:
Kozo::Commands::State show all
Defined in:
lib/kozo/commands/state/show.rb

Instance Attribute Summary collapse

Attributes inherited from Kozo::Commands::State

#subcommand

Attributes inherited from Kozo::Command

#args, #configuration

Instance Method Summary collapse

Constructor Details

#initialize(configuration, *args) ⇒ Show

Returns a new instance of Show.

Raises:



11
12
13
14
15
16
# File 'lib/kozo/commands/state/show.rb', line 11

def initialize(configuration, *args)
  @configuration = configuration
  @address = args.shift

  raise UsageError, "address not specified" unless address
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



9
10
11
# File 'lib/kozo/commands/state/show.rb', line 9

def address
  @address
end

Instance Method Details

#startObject

Raises:



18
19
20
21
22
23
24
25
26
# File 'lib/kozo/commands/state/show.rb', line 18

def start
  resource = state
    .resources
    .find { |r| r.address == address }

  raise StateError, "no such resource address: #{address}" unless resource

  Kozo.logger.info Operations::Show.new(resource).to_s
end