Class: Gitgut::Github::PullRequest
- Inherits:
-
Object
- Object
- Gitgut::Github::PullRequest
- Defined in:
- lib/gitgut/github.rb
Overview
A Github pull request
Instance Attribute Summary collapse
-
#merged_at ⇒ Object
readonly
Returns the value of attribute merged_at.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #color ⇒ Object
-
#initialize(payload) ⇒ PullRequest
constructor
A new instance of PullRequest.
- #merged? ⇒ Boolean
Constructor Details
#initialize(payload) ⇒ PullRequest
Returns a new instance of PullRequest.
14 15 16 17 18 19 20 21 |
# File 'lib/gitgut/github.rb', line 14 def initialize(payload) @number = payload[:number].to_s @state = payload[:state] # @url = payload[:url] # @title = payload[:title] @merged_at = payload[:merged_at] # @closed_at = payload[:closed_at] end |
Instance Attribute Details
#merged_at ⇒ Object (readonly)
Returns the value of attribute merged_at.
12 13 14 |
# File 'lib/gitgut/github.rb', line 12 def merged_at @merged_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
12 13 14 |
# File 'lib/gitgut/github.rb', line 12 def number @number end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
12 13 14 |
# File 'lib/gitgut/github.rb', line 12 def state @state end |
Instance Method Details
#color ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/gitgut/github.rb', line 23 def color case state when 'open' :white when 'closed' merged? ? :green : :light_black end end |
#merged? ⇒ Boolean
32 33 34 |
# File 'lib/gitgut/github.rb', line 32 def merged? !@merged_at.nil? end |