Class: Me::Identity
- Inherits:
-
Object
- Object
- Me::Identity
- Defined in:
- lib/me/identity.rb
Overview
Represents certain person, or person in certain role or situation
Defined Under Namespace
Classes: Mapper
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #activate ⇒ Object
- #build_view(view_factory) ⇒ Object
- #git_config ⇒ Object
-
#initialize(name) ⇒ Identity
constructor
A new instance of Identity.
- #ssh_config ⇒ Object
- #with_mapper(mapper) ⇒ Object
Constructor Details
#initialize(name) ⇒ Identity
Returns a new instance of Identity.
7 8 9 |
# File 'lib/me/identity.rb', line 7 def initialize(name) @name = name end |
Class Method Details
.active ⇒ Object
43 44 45 |
# File 'lib/me/identity.rb', line 43 def active Registry.identity_mapper_factory.new.find end |
.build(mapper:, name:, active_identity:) ⇒ Object
47 48 49 |
# File 'lib/me/identity.rb', line 47 def build(mapper:, name:, active_identity:) Identity.new(name).with_mapper(mapper) end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 14 |
# File 'lib/me/identity.rb', line 11 def ==(other) return false unless other.is_a?(Identity) self.name == other.name end |
#activate ⇒ Object
20 21 22 |
# File 'lib/me/identity.rb', line 20 def activate mapper.update(active_identity: name) end |
#build_view(view_factory) ⇒ Object
16 17 18 |
# File 'lib/me/identity.rb', line 16 def build_view(view_factory) view_factory.new(name: name) end |
#git_config ⇒ Object
24 25 26 |
# File 'lib/me/identity.rb', line 24 def git_config GitConfig.for_identity(name) end |
#ssh_config ⇒ Object
28 29 30 |
# File 'lib/me/identity.rb', line 28 def ssh_config SshConfig.for_identity(name) end |
#with_mapper(mapper) ⇒ Object
32 33 34 35 |
# File 'lib/me/identity.rb', line 32 def with_mapper(mapper) @mapper = mapper self end |