Sha256: 514c5b1954302f18b2d32c388d1d58ab07222de4a1da138461714ba0cb75fa07

Contents?: true

Size: 613 Bytes

Versions: 14

Compression:

Stored size: 613 Bytes

Contents

module Mongoid
  module Userstamp
    class Config
      attr_writer :user_model
      attr_accessor :user_reader
      attr_accessor :creator_field
      attr_accessor :updater_field

      def initialize(&block)
        reset!
        instance_eval(&block) if block_given?
      end

      def reset!
        @user_model = :user
        @user_reader = :current_user
        @creator_field = :creator
        @updater_field = :updater
      end

      def user_model_name
        @user_model.to_s.classify
      end

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
glebtv_mongoid_userstamp-0.10.0 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.9.2 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.9.1 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.9.0 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.8.0 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.7.2 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.7.1 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.7.0 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.6.2 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.6.1 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.6.0 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.5.0 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.4.1 lib/mongoid/userstamp/config.rb
glebtv_mongoid_userstamp-0.4.0 lib/mongoid/userstamp/config.rb