Class: Milestoner::Configuration::Transformers::Project::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/milestoner/configuration/transformers/project/author.rb

Overview

Conditionally updates author based on Git user.

Instance Method Summary collapse

Constructor Details

#initialize(key = :project_author) ⇒ Author

Returns a new instance of Author.



14
15
16
17
# File 'lib/milestoner/configuration/transformers/project/author.rb', line 14

def initialize(key = :project_author, **)
  @key = key
  super(**)
end

Instance Method Details

#call(attributes) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/milestoner/configuration/transformers/project/author.rb', line 19

def call attributes
  attributes.fetch key do
    git.get("user.name", nil).bind { |value| attributes.merge! key => value if value }
  end

  Success attributes
end