Class: PullRequest
- Inherits:
-
Object
- Object
- PullRequest
- Defined in:
- lib/newsman/pull_request.rb
Overview
This class represents GitHub Pull Request abstraction. In the future, it might be any Pull or Merge request.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #detailed_title ⇒ Object
-
#initialize(repository, title, description, url: 'undefined') ⇒ PullRequest
constructor
A new instance of PullRequest.
- #to_json(*_args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(repository, title, description, url: 'undefined') ⇒ PullRequest
Returns a new instance of PullRequest.
30 31 32 33 34 35 |
# File 'lib/newsman/pull_request.rb', line 30 def initialize(repository, title, description, url: 'undefined') @repository = repository @title = title @description = description @url = url end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
27 28 29 |
# File 'lib/newsman/pull_request.rb', line 27 def description @description end |
#repository ⇒ Object
Returns the value of attribute repository.
27 28 29 |
# File 'lib/newsman/pull_request.rb', line 27 def repository @repository end |
#title ⇒ Object
Returns the value of attribute title.
27 28 29 |
# File 'lib/newsman/pull_request.rb', line 27 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
28 29 30 |
# File 'lib/newsman/pull_request.rb', line 28 def url @url end |
Instance Method Details
#detailed_title ⇒ Object
50 51 52 |
# File 'lib/newsman/pull_request.rb', line 50 def detailed_title "title: #{@title}, repo: #{@repository}, url: #{@url}" end |
#to_json(*_args) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/newsman/pull_request.rb', line 37 def to_json(*_args) { title: @title, description: @description, repository: @repository, url: @url }.to_json end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/newsman/pull_request.rb', line 46 def to_s "title: ```#{@title}```,\ndescription: ```#{@description}```,\nrepo: ```#{@repository}```\n" end |