Class: ChangelogGenerator::Issue
- Inherits:
-
Object
- Object
- ChangelogGenerator::Issue
- Defined in:
- lib/changelog_generator/issue.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
Returns the value of attribute number.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Issue
constructor
A new instance of Issue.
-
#link_text(user, repo, formatting_style) ⇒ Object
- Generates a link snippet for this issue with desired text formatting Params:
user - The username of the repo owner
repo - The name of the github repository
formatting_style -
The text formatting style symbol.
- The name of the github repository
- The username of the repo owner
- Generates a link snippet for this issue with desired text formatting Params:
Constructor Details
#initialize(args) ⇒ Issue
Returns a new instance of Issue.
13 14 15 16 17 |
# File 'lib/changelog_generator/issue.rb', line 13 def initialize(args) args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/changelog_generator/issue.rb', line 4 def number @number end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/changelog_generator/issue.rb', line 3 def title @title end |
Class Method Details
.from_github_issue(github_issue) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/changelog_generator/issue.rb', line 6 def self.from_github_issue(github_issue) self.new({ title: github_issue['title'], number: github_issue['number'] }) end |
Instance Method Details
#link_text(user, repo, formatting_style) ⇒ Object
Generates a link snippet for this issue with desired text formatting Params:
user-
The username of the repo owner
repo-
The name of the github repository
formatting_style-
The text formatting style symbol
24 25 26 27 28 29 30 31 |
# File 'lib/changelog_generator/issue.rb', line 24 def link_text(user, repo, formatting_style) if formatting_style == :slack return " <https://github.com/#{user}/#{repo}/issues/#{self.number}|##{self.number}>" elsif formatting_style == :markdown return " [##{self.number}](https://github.com/#{user}/#{repo}/issues/#{self.number})" end return "" end |