Class: Kleiber::Terminal

Inherits:
Object
  • Object
show all
Defined in:
lib/kleiber/terminal.rb

Overview

Class Terminal provides api for current terminal

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Terminal

Returns a new instance of Terminal.



8
9
10
11
12
13
# 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

Instance Attribute Details

#execObject (readonly)

Returns the value of attribute exec.



7
8
9
# File 'lib/kleiber/terminal.rb', line 7

def exec
  @exec
end

#exec_commandObject (readonly)

Returns the value of attribute exec_command.



7
8
9
# File 'lib/kleiber/terminal.rb', line 7

def exec_command
  @exec_command
end

#new_tabObject (readonly)

Returns the value of attribute new_tab.



7
8
9
# File 'lib/kleiber/terminal.rb', line 7

def new_tab
  @new_tab
end

#titleObject (readonly)

Returns the value of attribute title.



7
8
9
# File 'lib/kleiber/terminal.rb', line 7

def title
  @title
end

Instance Method Details

#execute(scriptfile) ⇒ Object

Runs command line in new tab

Parameters:

  • line (String)

    line to execute



17
18
19
20
# File 'lib/kleiber/terminal.rb', line 17

def execute(scriptfile)
  puts command_line.command(script: scriptfile.path)
  command_line.run(script: scriptfile.path)
end