Class: YleTf::Action::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/yle_tf/action/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, command) ⇒ Command

Returns a new instance of Command.



8
9
10
11
# File 'lib/yle_tf/action/command.rb', line 8

def initialize(app, command)
  @app = app
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



6
7
8
# File 'lib/yle_tf/action/command.rb', line 6

def command
  @command
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/yle_tf/action/command.rb', line 13

def call(env)
  if env[:tf_options][:only_hooks]
    Logger.debug "Skipping command #{command.class} due to `--only-hooks`"
  else
    Logger.debug "Executing command #{command.class} with env: #{env.inspect}"
    command.new.execute(env)
  end

  @app.call(env)
end