Sha256: 78cda7131329b4961d79aa5027294bf3e3c2d2fce996c3ccaa35ed07a9342b60

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

Stored size: 474 Bytes

Contents

require 'colorize'

module Groupme
  module Cli
    class Message
      attr_reader :sender, :time, :text

      def initialize(sender:, time:, text:)
        @sender, @time, @text = sender, time, text
      end

      def to_s
        "<#{@sender.colorize :blue}[#{fmt_time.colorize :red}]>:\n\t#{fmt_text}"
      end

      private
      def fmt_time
        @time.strftime "%I:%M%p"
      end

      def fmt_text
        @text.lines.join "\t"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
groupme-cli-0.2.0 lib/groupme/cli/message.rb
groupme-cli-0.1.0 lib/groupme/cli/message.rb