Class: HustleAndFlow::IssueTrackers::Github::Commands::Start
- Inherits:
-
Object
- Object
- HustleAndFlow::IssueTrackers::Github::Commands::Start
- Defined in:
- lib/hustle_and_flow/issue_trackers/github/commands/start.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
-
#issues ⇒ Object
Returns the value of attribute issues.
-
#me ⇒ Object
Returns the value of attribute me.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#number ⇒ Object
Returns the value of attribute number.
-
#statuses ⇒ Object
readonly
Returns the value of attribute statuses.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tracker ⇒ Object
Returns the value of attribute tracker.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**args) ⇒ Start
constructor
A new instance of Start.
Constructor Details
#initialize(**args) ⇒ Start
Returns a new instance of Start.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 20 def initialize(**args) self.mode = args[:options][:create] self.labels = args[:options][:type] self.statuses = args[:options][:status] self.title = args[:options][:title] self.number = args[:options][:number] self.me = args[:me] self.io = args[:io] self.tracker = Github::Tracker.new(repo: args[:repo]) self.issues = Issues.new(tracker: tracker, io: io, statuses: statuses) end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def io @io end |
#issues ⇒ Object
Returns the value of attribute issues.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def issues @issues end |
#me ⇒ Object
Returns the value of attribute me.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def me @me end |
#mode ⇒ Object
Returns the value of attribute mode.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def mode @mode end |
#number ⇒ Object
Returns the value of attribute number.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def number @number end |
#statuses ⇒ Object
Returns the value of attribute statuses.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def statuses @statuses end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def title @title end |
#tracker ⇒ Object
Returns the value of attribute tracker.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 10 def tracker @tracker end |
Class Method Details
.call(**args) ⇒ Object
56 57 58 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 56 def self.call(**args) new(**args).call end |
Instance Method Details
#call ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/start.rb', line 34 def call if !issue_specified? && mode == 'search' applicable_issues = issues.filter_by(issue_data) io.print_formatted_table \ data: Formatters::IssueTableFormatter.new(applicable_issues).to_ary, title: 'Available Issues' self.number = io.choose_issue until issue_specified? end if issue_specified? issue = issues.find_or_create(issue_data) if io.correct_issue?(issue) issue.start(me: me) end else fail ArgumentError.new("You must specify both type and a title when starting a new issue") end end |