Class: HustleAndFlow::IssueTrackers::Github::Issues
- Inherits:
-
Object
- Object
- HustleAndFlow::IssueTrackers::Github::Issues
- Includes:
- Enumerable
- Defined in:
- lib/hustle_and_flow/issue_trackers/github/issues.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
-
#issues ⇒ Object
writeonly
Sets the attribute issues.
-
#statuses ⇒ Object
readonly
Returns the value of attribute statuses.
-
#tracker ⇒ Object
Returns the value of attribute tracker.
Instance Method Summary collapse
- #each ⇒ Object
- #filter_by(**args) ⇒ Object
- #filter_by_branch(branch:) ⇒ Object
- #find_or_create(**args) ⇒ Object
-
#initialize(tracker:, io:, issues: nil, statuses: nil) ⇒ Issues
constructor
A new instance of Issues.
Constructor Details
#initialize(tracker:, io:, issues: nil, statuses: nil) ⇒ Issues
Returns a new instance of Issues.
14 15 16 17 18 19 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 14 def initialize(tracker:, io:, issues: nil, statuses: nil) self.io = io self.tracker = tracker self.statuses = statuses self.issues = issues end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
9 10 11 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 9 def io @io end |
#issues=(value) ⇒ Object
Sets the attribute issues
9 10 11 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 9 def issues=(value) @issues = value end |
#statuses ⇒ Object
Returns the value of attribute statuses.
9 10 11 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 9 def statuses @statuses end |
#tracker ⇒ Object
Returns the value of attribute tracker.
9 10 11 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 9 def tracker @tracker end |
Instance Method Details
#each ⇒ Object
25 26 27 28 29 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 25 def each issues.each do |issue| yield issue end end |
#filter_by(**args) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 31 def filter_by(**args) self.class.new(io: io, tracker: tracker, issues: issues.select do |issue| issue if issue.match?(**args) end) end |
#filter_by_branch(branch:) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hustle_and_flow/issue_trackers/github/issues.rb', line 39 def filter_by_branch(branch:) data_from_branch = Issue. from_branch_name(branch). each_with_object({}) do |item, memo| memo[item[0]] = item[1] unless item[1].nil? end self.class.new(io: io, tracker: tracker, issues: issues.select do |issue| issue if issue.match?(**data_from_branch) end) end |