Module: Ccp::Receivers::Commentable

Included in:
Base
Defined in:
lib/ccp/receivers/commentable.rb

Defined Under Namespace

Classes: Comment

Instance Method Summary collapse

Instance Method Details

#comment(text, level = nil) ⇒ Object



18
19
20
# File 'lib/ccp/receivers/commentable.rb', line 18

def comment(text, level = nil)
  comments[text] ||= Comment.new(text, level)
end

#commentsObject



22
23
24
# File 'lib/ccp/receivers/commentable.rb', line 22

def comments
  @comments ||= ActiveSupport::OrderedHash.new
end

#show_comments(*args) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/ccp/receivers/commentable.rb', line 26

def show_comments(*args)
  opts   = Optionize.new(args, :output)
  output = opts[:output] || $stderr
  comments.each_value do |comment|
    output.puts comment.colorized
  end
end