Class: Crosstest::Psychic::CommandTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/crosstest/psychic/command_template.rb

Direct Known Subclasses

Script, Task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(psychic, template) ⇒ CommandTemplate

Returns a new instance of CommandTemplate


6
7
8
9
10
# File 'lib/crosstest/psychic/command_template.rb', line 6

def initialize(psychic, template)
  @psychic = psychic
  fail ArgumentError, 'Cannot create a nil command' if template.nil?
  @template = template
end

Instance Attribute Details

#psychicObject (readonly)

Returns the value of attribute psychic


4
5
6
# File 'lib/crosstest/psychic/command_template.rb', line 4

def psychic
  @psychic
end

Instance Method Details

#command(params = {}) ⇒ Object Also known as: to_s


12
13
14
# File 'lib/crosstest/psychic/command_template.rb', line 12

def command(params = {})
  Tokens.replace_tokens(build_command, params)
end

#execute(params = {}, *extra_args) ⇒ Object


16
17
18
# File 'lib/crosstest/psychic/command_template.rb', line 16

def execute(params = {}, *extra_args)
  @psychic.execute(command(params), *extra_args)
end