Class: Jirify::UI::IssueRenderer
- Inherits:
-
Object
- Object
- Jirify::UI::IssueRenderer
- Defined in:
- lib/jirify/ui/issue_renderer.rb
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
Instance Method Summary collapse
- #as_card(options) ⇒ Object
- #as_table_cell(options) ⇒ Object
-
#initialize(issue) ⇒ IssueRenderer
constructor
A new instance of IssueRenderer.
Constructor Details
#initialize(issue) ⇒ IssueRenderer
Returns a new instance of IssueRenderer.
8 9 10 |
# File 'lib/jirify/ui/issue_renderer.rb', line 8 def initialize(issue) @issue = issue end |
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
6 7 8 |
# File 'lib/jirify/ui/issue_renderer.rb', line 6 def issue @issue end |
Instance Method Details
#as_card(options) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/jirify/ui/issue_renderer.rb', line 28 def as_card() card = as_table_cell() Terminal::Table.new(rows: [[card]]) rescue RuntimeError raise UI::WindowTooNarrow, 'The terminal window is too narrow.' end |
#as_table_cell(options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jirify/ui/issue_renderer.rb', line 12 def as_table_cell() [:max_length] ||= IO.console.winsize[1] - 4 [:summary] ||= false [:url] ||= false [:assignee] ||= false raise UI::WindowTooNarrow, 'The terminal window is too narrow.' if [:max_length] <= key.size row = '' row << "#{ColorizedString[key].bold}" row << summary_line() if show_summary?() row << url_line if show_url?() row << assignee_line() if show_assignee?() row end |