Class: Me::Mappers::GitConfigStore2
- Inherits:
-
GitConfig::Mapper
- Object
- GitConfig::Mapper
- Me::Mappers::GitConfigStore2
- Defined in:
- lib/me/mappers/git_config_store2.rb
Class Method Summary collapse
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(name, email, identity_name) ⇒ GitConfigStore2
constructor
A new instance of GitConfigStore2.
- #update(name: nil, email: nil) ⇒ Object
Constructor Details
#initialize(name, email, identity_name) ⇒ GitConfigStore2
Returns a new instance of GitConfigStore2.
11 12 13 14 15 |
# File 'lib/me/mappers/git_config_store2.rb', line 11 def initialize(name, email, identity_name) @identity_name = identity_name @name = name || fetch_name @email = email || fetch_email end |
Class Method Details
.find_by_identity(identity_name) ⇒ Object
7 8 9 |
# File 'lib/me/mappers/git_config_store2.rb', line 7 def self.find_by_identity(identity_name) new(nil, nil, identity_name).find end |
Instance Method Details
#find ⇒ Object
17 18 19 20 21 22 |
# File 'lib/me/mappers/git_config_store2.rb', line 17 def find ensure_present GitConfig .new(name, email, identity_name) .with_mapper(self) end |
#update(name: nil, email: nil) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/me/mappers/git_config_store2.rb', line 24 def update(name: nil, email: nil) return unless name || email scoped.set("name", name) if name scoped.set("email", email) if email scoped.save end |