Class: Flowdock::Git::Builder
- Inherits:
-
Object
- Object
- Flowdock::Git::Builder
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- lib/flowdock/git/builder.rb
Overview
Class used to build Git payload
Instance Method Summary collapse
- #commits ⇒ Object
-
#initialize(opts) ⇒ Builder
constructor
A new instance of Builder.
- #ref_name ⇒ Object
- #to_hashes ⇒ Object
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Constructor Details
#initialize(opts) ⇒ Builder
Returns a new instance of Builder.
81 82 83 84 85 86 87 |
# File 'lib/flowdock/git/builder.rb', line 81 def initialize(opts) @repo = opts[:repo] @ref = opts[:ref] @before = opts[:before] @after = opts[:after] @opts = opts end |
Instance Method Details
#commits ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/flowdock/git/builder.rb', line 89 def commits @repo.commits_between(@before, @after).map do |commit| { url: @opts[:commit_url] ? @opts[:commit_url] % [commit.sha] : nil, id: commit.sha, message: commit., author: { name: commit., email: commit. } } end end |
#ref_name ⇒ Object
103 104 105 |
# File 'lib/flowdock/git/builder.rb', line 103 def ref_name @ref.to_s.sub(%r{\Arefs/(heads|tags)/}, '') end |