Class: Flowdock::Git::Builder
- Inherits:
-
Object
- Object
- Flowdock::Git::Builder
- 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
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: if @opts[:commit_url] then @opts[:commit_url] % [commit.sha] end, id: commit.sha, message: commit., author: { name: commit..name, email: commit..email } } end end |
#ref_name ⇒ Object
103 104 105 |
# File 'lib/flowdock/git/builder.rb', line 103 def ref_name @ref.to_s.sub(/\Arefs\/(heads|tags)\//, '') end |