Sha256: 3d438bd2b423078585e07f8a30246b75a0e36f8184239be0ee0090ebc230b08f

Contents?: true

Size: 694 Bytes

Versions: 4

Compression:

Stored size: 694 Bytes

Contents

# -*- encoding : utf-8 -*-
module Mongoid
  module Userstamp
    class Config
      attr_accessor :user_reader
      attr_accessor :user_model

      attr_accessor :created_column
      attr_accessor :created_accessor

      attr_accessor :updated_column
      attr_accessor :updated_accessor

      def initialize(&block)
        @user_reader = :current_user
        @user_model = :user

        @created_column = :created_by
        @created_accessor = :creator

        @updated_column = :updated_by
        @updated_accessor = :updator

        instance_eval(&block) if block_given?
      end

      def user_model
        @user_model.to_s.classify.constantize
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid_userstamp-0.1.3 lib/mongoid/userstamp/config.rb
mongoid_userstamp-0.1.2 lib/mongoid/userstamp/config.rb
mongoid_userstamp-0.1.1 lib/mongoid/userstamp/config.rb
mongoid_userstamp-0.1.0 lib/mongoid/userstamp/config.rb