Sha256: 594fda90f79760f83b91ce88a0cc7dd67a0f323a33beab5a9cd6bf1f26699334

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

# encoding: utf-8

require 'active_support/core_ext'

module Lockdown
  DELIMITER = '^+^'

  module Helper
    # @return [Regexp] with \A \z boundaries
    def regex(string)
      Regexp.new(/\A#{string}\z/)
    end

    def administrator_group_name
      'Administrators'
    end

    def user_group_class
      eval("::#{Lockdown::Configuration.user_group_model}")
    end

    def user_groups_hbtm_reference
      Lockdown::Configuration.user_group_model.underscore.pluralize.to_sym
    end

    def user_group_id_reference
      Lockdown::Configuration.user_group_model.underscore + "_id"
    end

    def user_class
      eval("::#{Lockdown::Configuration.user_model}")
    end

    def users_hbtm_reference
      Lockdown::Configuration.user_model.underscore.pluralize.to_sym
    end

    def user_id_reference
      Lockdown::Configuration.user_model.underscore + "_id"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lockdown-2.0.7 lib/lockdown/helper.rb
lockdown-2.0.6 lib/lockdown/helper.rb