Sha256: 2273ecde3c82c028431c84b1607671a738da35f2f5faa4e826cc73f689876bb2

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

module BrowsingHistory::Historizable
  def self.included(klass)
    klass.include IdentifyMethods
    klass.extend  IdentifyMethods
  end

  module IdentifyMethods
    attr_accessor :target_storage

    def historizable_id
      historizable_instance? ? id : nil
    end

    def historizable_type
      historizable_instance? ? self.class.to_s : to_s
    end

    def historizable_class
      historizable_instance? ? self.class : self
    end

    def historizable_instance?
      !instance_of?(Object)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
browsing_history-0.0.3 lib/browsing_history/historizable.rb
browsing_history-0.0.2 lib/browsing_history/historizable.rb