Class: Threeman::Frontend

Inherits:
Object
  • Object
show all
Defined in:
lib/threeman/frontend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Frontend

Returns a new instance of Frontend.



7
8
9
# File 'lib/threeman/frontend.rb', line 7

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/threeman/frontend.rb', line 5

def options
  @options
end

Instance Method Details

#bash_script(command) ⇒ Object



15
16
17
18
19
20
# File 'lib/threeman/frontend.rb', line 15

def bash_script(command)
  [
    "echo -ne \"\\033]0;#{Shellwords.escape command.name}\\007\"",
    command.bash_script
  ].join(" ; ")
end

#paned_command_namesObject



26
27
28
# File 'lib/threeman/frontend.rb', line 26

def paned_command_names
  options[:panes] || []
end

#run_commands(commands) ⇒ Object



11
12
13
# File 'lib/threeman/frontend.rb', line 11

def run_commands(commands)
  raise "Subclasses must implement #run_commands"
end

#sort_commands(commands) ⇒ Object



22
23
24
# File 'lib/threeman/frontend.rb', line 22

def sort_commands(commands)
  commands.sort_by { |c| paned_command_names.include?(c.name) ? 0 : 1 }
end