Sha256: e58d2f21f02d1c2bbc48a9082e8ae0cfc7af2df45846c83b5234114c9c584aed

Contents?: true

Size: 408 Bytes

Versions: 2

Compression:

Stored size: 408 Bytes

Contents

require 'active_support/concern'

module MarkAsRead
  module Readable

    extend ActiveSupport::Concern

    included do
      cattr_accessor :mark_as_read_proc
    end

    module ClassMethods
      def mark_as_read(&block)
        self.mark_as_read_proc = block
      end
    end

    def mark_as_read!
      if self.mark_as_read_proc
        self.mark_as_read_proc.call(self)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mark_as_read-0.0.2 lib/mark_as_read/readable.rb
mark_as_read-0.0.1 lib/mark_as_read/readable.rb