Class: Me::GitConfig
- Inherits:
-
Object
- Object
- Me::GitConfig
- Defined in:
- lib/me/git_config.rb
Overview
Represents piece of personalised git configuration
Defined Under Namespace
Classes: Mapper
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #activate ⇒ Object
- #build_view(view_factory) ⇒ Object
- #configure ⇒ Object
-
#initialize(name, email, identity_name) ⇒ GitConfig
constructor
A new instance of GitConfig.
- #with_mapper(mapper) ⇒ Object
Constructor Details
#initialize(name, email, identity_name) ⇒ GitConfig
Returns a new instance of GitConfig.
7 8 9 10 11 |
# File 'lib/me/git_config.rb', line 7 def initialize(name, email, identity_name) @name = name @email = email @identity_name = identity_name end |
Class Method Details
.for_identity(identity_name) ⇒ Object
53 54 55 |
# File 'lib/me/git_config.rb', line 53 def for_identity(identity_name) Registry.git_config_mapper_factory.find_by_identity(identity_name) end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 |
# File 'lib/me/git_config.rb', line 18 def ==(other) return false unless other.is_a?(GitConfig) self.equality_fields == other.equality_fields end |
#activate ⇒ Object
28 29 30 31 |
# File 'lib/me/git_config.rb', line 28 def activate activation.call activation end |
#build_view(view_factory) ⇒ Object
33 34 35 |
# File 'lib/me/git_config.rb', line 33 def build_view(view_factory) view_factory.new(name: name, email: email) end |
#configure ⇒ Object
23 24 25 26 |
# File 'lib/me/git_config.rb', line 23 def configure return unless name && email mapper.update(name: name, email: email) end |
#with_mapper(mapper) ⇒ Object
13 14 15 16 |
# File 'lib/me/git_config.rb', line 13 def with_mapper(mapper) @mapper = mapper self end |