Sha256: 6bddf40dac5f4d2011cc4de5becad7976fcd1c7af67442da9282a875851ed8d5

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

require 'time'
require 'memoizable'

module Twitter
  module Creatable
    include Memoizable

    # Time when the object was created on Twitter
    #
    # @return [Time]
    def created_at
      time = @attrs[:created_at]
      return if time.nil?

      time = Time.parse(time) unless time.is_a?(Time)
      time.utc
    end
    memoize :created_at

    # @return [Boolean]
    def created?
      !!@attrs[:created_at]
    end
    memoize :created?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter-7.0.0 lib/twitter/creatable.rb