Class: Seira::Commands::Teleport

Inherits:
Object
  • Object
show all
Defined in:
lib/seira/commands/teleport.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, context: nil) ⇒ Teleport

Returns a new instance of Teleport.



6
7
8
9
# File 'lib/seira/commands/teleport.rb', line 6

def initialize(command, context: nil)
  @command = command
  @context = context
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



4
5
6
# File 'lib/seira/commands/teleport.rb', line 4

def command
  @command
end

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/seira/commands/teleport.rb', line 4

def context
  @context
end

Instance Method Details

#invoke(clean_output: false, return_output: false) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/seira/commands/teleport.rb', line 11

def invoke(clean_output: false, return_output: false)
  puts "Calling: #{calculated_command.green}" unless clean_output

  if return_output
    `#{calculated_command}`
  else
    system(calculated_command)
  end
end