Class: Me::Mappers::SshConfigStore2

Inherits:
SshConfig::Mapper show all
Defined in:
lib/me/mappers/ssh_config_store2.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keys, identity_name) ⇒ SshConfigStore2

Returns a new instance of SshConfigStore2.



12
13
14
15
# File 'lib/me/mappers/ssh_config_store2.rb', line 12

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

Class Method Details

.find_by_identity(identity_name) ⇒ Object



8
9
10
# File 'lib/me/mappers/ssh_config_store2.rb', line 8

def self.find_by_identity(identity_name)
  new(nil, identity_name).find
end

Instance Method Details

#findObject



17
18
19
20
21
22
# File 'lib/me/mappers/ssh_config_store2.rb', line 17

def find
  ensure_present
  SshConfig
    .new(keys, identity_name)
    .with_mapper(self)
end

#update(keys: nil, identity_name: nil) ⇒ Object



24
25
26
27
28
# File 'lib/me/mappers/ssh_config_store2.rb', line 24

def update(keys: nil, identity_name: nil)
  return unless keys
  scoped.set("keys", keys)
  scoped.save
end