Class: TmuxConnector::Start
- Inherits:
-
Object
- Object
- TmuxConnector::Start
- Defined in:
- lib/tmux-connector/commands/start.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#merge_rules ⇒ Object
readonly
Returns the value of attribute merge_rules.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#initialize(args) ⇒ Start
constructor
A new instance of Start.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Start
Returns a new instance of Start.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tmux-connector/commands/start.rb', line 15 def initialize(args) if args['<config-file>'] @config = TmuxConnector.get_config args['<config-file>'] elsif args['--quick-session'] @config = quick_session_to_config args['--quick-session'] end ssh_hostnames = SSHConfig.get_hosts(args['--ssh-config'], config['reject-regex']) @hosts = ssh_hostnames.reduce([]) do |acc, name| ( acc << Host.new(name, config) ) rescue nil acc end raise "no hosts matching given configuration found, check your configuration" if hosts.empty? generate_groups generate_merge_rules @session = Session.new config, args, groups, merge_rules end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/tmux-connector/commands/start.rb', line 9 def config @config end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
11 12 13 |
# File 'lib/tmux-connector/commands/start.rb', line 11 def groups @groups end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
10 11 12 |
# File 'lib/tmux-connector/commands/start.rb', line 10 def hosts @hosts end |
#merge_rules ⇒ Object (readonly)
Returns the value of attribute merge_rules.
12 13 14 |
# File 'lib/tmux-connector/commands/start.rb', line 12 def merge_rules @merge_rules end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
13 14 15 |
# File 'lib/tmux-connector/commands/start.rb', line 13 def session @session end |
Instance Method Details
#run ⇒ Object
35 36 37 38 |
# File 'lib/tmux-connector/commands/start.rb', line 35 def run() session.save session.start end |