Class: DitzStr::ScreenView
Instance Method Summary collapse
-
#initialize(project, config, device = $stdout) ⇒ ScreenView
constructor
A new instance of ScreenView.
- #render_issue(issue) ⇒ Object
Methods inherited from View
add_to_view, view_additions_for
Constructor Details
#initialize(project, config, device = $stdout) ⇒ ScreenView
Returns a new instance of ScreenView.
7 8 9 10 |
# File 'lib/ditzstr/views.rb', line 7 def initialize project, config, device=$stdout @device = device @config = config end |
Instance Method Details
#render_issue(issue) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ditzstr/views.rb', line 21 def render_issue issue status = case issue.status when :closed "#{issue.status_string}: #{issue.disposition_string}" else issue.status_string end desc = if issue.desc.size < 80 - "Description: ".length issue.desc else "\n" + issue.desc.gsub(/^/, " ") + "\n" end @device.puts <<EOS #{"Issue #{issue.name}".underline} Title: #{issue.title} Description: #{desc} Type: #{issue.type} Status: #{status} Creator: #{issue.reporter} Age: #{issue.creation_time.ago} Release: #{issue.release} References: #{issue.references.listify " "} Identifier: #{issue.id} EOS self.class.view_additions_for(:issue_summary).each { |b| @device.print(b[issue, @config] || next) } puts self.class.view_additions_for(:issue_details).each { |b| @device.print(b[issue, @config] || next) } @device.puts <<EOS Event log: #{format_log_events issue.log_events} EOS end |