Sha256: e5f6230e4319a3cd0eec2012609316cdfe7fa98960ec8ba9d31fff645425876c
Contents?: true
Size: 1005 Bytes
Versions: 2
Compression:
Stored size: 1005 Bytes
Contents
module Troo module Commands class ShowComments attr_reader :id class << self # @param [] # @return [] def dispatch(id = nil) new(id).render end end # @param [] # @return [] def initialize(id = nil) @id = id end # @return [] def render if resource presenter elsif no_default? [error, no_default].join(' ') else error end end private def presenter resource.comment_presenter.show end def error "#{type.capitalize} cannot be found." end def no_default? id.nil? && resource.nil? end def no_default "Specify an <id> or use 'troo default #{type} <id>' " \ "to set a default #{type} first." end def type 'card' end def resource @resource ||= Troo::Card.retrieve(id) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.12 | lib/troo/cli/commands/show/show_comments.rb |
troo-0.0.11 | lib/troo/cli/commands/show/show_comments.rb |