Sha256: aa351c33023e6a590f5ab37080bc111474861e17bc40b7e4724141943602af2c

Contents?: true

Size: 500 Bytes

Versions: 2

Compression:

Stored size: 500 Bytes

Contents

module Pipio
  class StatusMessageCreator
    def initialize(text, time, alias_registry)
      @text = text
      @time = time
      @alias_registry = alias_registry
    end

    def create
      regex, status = StatusMessage::MAP.detect { |rxp, stat| @text =~ rxp }

      if regex && status
        sender_alias = regex.match(@text)[1]
        sender_screen_name = @alias_registry[sender_alias]
        StatusMessage.new(sender_screen_name, @time, sender_alias, status)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pipio-0.0.2 lib/pipio/message_creators/status_message_creator.rb
pipio-0.0.1 lib/pipio/message_creators/status_message_creator.rb