class Troo::Commands::ShowComments
Attributes
id[R]
Public Class Methods
dispatch(id = nil)
click to toggle source
@param [String] @return [String]
# File lib/troo/cli/commands/show/show_comments.rb, line 9 def dispatch(id = nil) new(id).render end
new(id = nil)
click to toggle source
@param [String] @return [Troo::Commands::ShowComments]
# File lib/troo/cli/commands/show/show_comments.rb, line 16 def initialize(id = nil) @id = id end
Public Instance Methods
render()
click to toggle source
@return [String]
# File lib/troo/cli/commands/show/show_comments.rb, line 21 def render if resource presenter elsif no_default? [error, no_default].join(' ') else error end end
Private Instance Methods
error()
click to toggle source
# File lib/troo/cli/commands/show/show_comments.rb, line 37 def error "#{type.capitalize} cannot be found." end
no_default()
click to toggle source
# File lib/troo/cli/commands/show/show_comments.rb, line 45 def no_default "Specify an <id> or use 'troo default #{type} <id>' " \ "to set a default #{type} first." end
no_default?()
click to toggle source
# File lib/troo/cli/commands/show/show_comments.rb, line 41 def no_default? id.nil? && resource.nil? end
presenter()
click to toggle source
# File lib/troo/cli/commands/show/show_comments.rb, line 33 def presenter resource.comment_presenter.show end
resource()
click to toggle source
# File lib/troo/cli/commands/show/show_comments.rb, line 54 def resource @resource ||= Troo::Card.retrieve(id) end
type()
click to toggle source
# File lib/troo/cli/commands/show/show_comments.rb, line 50 def type 'card' end