class Kleiber::Terminal

Class Terminal provides api for current terminal @author Кирилл Бобыкин <qelphybox@gmail.com>

Attributes

exec[R]
exec_command[R]
new_tab[R]
title[R]

Public Class Methods

new(settings) click to toggle source
# File lib/kleiber/terminal.rb, line 8
def initialize(settings)
  @exec         = settings[:exec]
  @new_tab      = settings[:new_tab]
  @title        = settings[:title]
  @exec_command = settings[:exec_command]
end

Public Instance Methods

execute(scriptfile) click to toggle source

Runs command line in new tab @param [String] line line to execute

# File lib/kleiber/terminal.rb, line 17
def execute(scriptfile)
  puts command_line.command(script: scriptfile.path)
  command_line.run(script: scriptfile.path)
end

Private Instance Methods

command_line() click to toggle source

Returns CommandLine for execution @param [File] scriptfile file with script to execute in machine @return [Cocaine::CommandLine] new command line to execute

# File lib/kleiber/terminal.rb, line 27
def command_line
  Cocaine::CommandLine.new(exec, options)
end
options() click to toggle source

Return options line @return [String] terminal options line

# File lib/kleiber/terminal.rb, line 33
def options
  options_line = ['-e :script']
  options_line.unshift(title) if title
  options_line.unshift(new_tab) if new_tab
  options_line.join(' ')
end