Class: TmuxConnector::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/tmux-connector/host.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config) ⇒ Host

Returns a new instance of Host.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tmux-connector/host.rb', line 12

def initialize(name, config)
  @ssh_name = name

  groups = name.match(config['regex'])[1..-1]
  @display_name = create_display_name groups, config
  @sort_value = config['regex-parts-to']['sort-by'].map { |i| groups[i] }.join '-'
  @group_id = config['regex-parts-to']['group-by'].map { |i| groups[i] }.join '-'

  check_range! config['group-ranges']
  @count = get_count config
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



7
8
9
# File 'lib/tmux-connector/host.rb', line 7

def count
  @count
end

#display_nameObject (readonly)

Returns the value of attribute display_name.



8
9
10
# File 'lib/tmux-connector/host.rb', line 8

def display_name
  @display_name
end

#group_idObject (readonly)

Returns the value of attribute group_id.



9
10
11
# File 'lib/tmux-connector/host.rb', line 9

def group_id
  @group_id
end

#sort_valueObject

Returns the value of attribute sort_value.



5
6
7
# File 'lib/tmux-connector/host.rb', line 5

def sort_value
  @sort_value
end

#ssh_nameObject (readonly)

Returns the value of attribute ssh_name.



10
11
12
# File 'lib/tmux-connector/host.rb', line 10

def ssh_name
  @ssh_name
end

Instance Method Details

#to_sObject



24
25
26
# File 'lib/tmux-connector/host.rb', line 24

def to_s()
  return "<host::#{ display_name }>"
end