Class: Me::SshConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/me/ssh_config.rb

Defined Under Namespace

Classes: Mapper

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keys, identity_name) ⇒ SshConfig

Returns a new instance of SshConfig.



6
7
8
9
# File 'lib/me/ssh_config.rb', line 6

def initialize(keys, identity_name)
  @keys = keys
  @identity_name = identity_name
end

Class Method Details

.for_identity(identity_name) ⇒ Object



47
48
49
# File 'lib/me/ssh_config.rb', line 47

def for_identity(identity_name)
  Registry.ssh_config_mapper_factory.find_by_identity(identity_name)
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
# File 'lib/me/ssh_config.rb', line 11

def ==(other)
  return false unless other.is_a?(SshConfig)
  self.keys == other.keys
end

#activateObject



26
27
28
29
# File 'lib/me/ssh_config.rb', line 26

def activate
  activation.call
  activation
end

#build_view(view_factory) ⇒ Object



31
32
33
# File 'lib/me/ssh_config.rb', line 31

def build_view(view_factory)
  view_factory.new(keys: keys)
end

#configureObject



21
22
23
24
# File 'lib/me/ssh_config.rb', line 21

def configure
  return if keys.empty?
  mapper.update(keys: keys)
end

#with_mapper(mapper) ⇒ Object



16
17
18
19
# File 'lib/me/ssh_config.rb', line 16

def with_mapper(mapper)
  @mapper = mapper
  self
end