Sha256: dd9892a4499083931b69ce974b32edd7bece0ee2bb2886354e0474ad1dd9a640

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

module Pipio
  # The container object for each Message in a chat. It includes the Enumerable
  # module, so each/map/reject etc all work and will iterate over the Messages.
  class Chat
    include Enumerable

    def initialize(messages, metadata)
      @messages = messages
      @metadata = metadata
    end

    attr_reader :messages

    def start_time_xmlschema
      @metadata.start_time.xmlschema
    end

    def my_screen_name
      @metadata.my_screen_name
    end

    def their_screen_name
      @metadata.their_screen_name
    end

    def service
      @metadata.service
    end

    def to_s
      map(&:to_s).join("\n")
    end

    # Iterate over each Message.
    def each(&block)
      @messages.each(&block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pipio-0.0.1 lib/pipio/chat.rb