Sha256: 9b667d5e53c147168d20af615c3232d2717061f118ed605e0a664c34318cbcf7

Contents?: true

Size: 1.72 KB

Versions: 9

Compression:

Stored size: 1.72 KB

Contents

module RailsAdminSettings
  module RequireHelpers
    private

    def require_russian_phone
      begin
        require 'russian_phone'
        yield
      rescue LoadError => e
        e.message << " [rails_admin_settings] Please add gem 'russian_phone' to use phone settings"
        raise e
      end
    end

    def require_safe_yaml
      begin
        require 'safe_yaml'
        yield
      rescue LoadError => e
        e.message << " [rails_admin_settings] Please add gem 'safe_yaml' to your Gemfile to use yaml settings"
        raise e
      end
    end

    def require_sanitize
      begin
        require 'sanitize'
        yield
      rescue LoadError => e
        e.message << " [rails_admin_settings] Please add gem 'sanitize' to your Gemfile to use sanitized settings"
        raise e
      end
    end

    def require_validates_email_format_of
      begin
        require 'validates_email_format_of'
        yield
      rescue LoadError => e
        e.message << " [rails_admin_settings] Please add gem 'validates_email_format_of' to your Gemfile to use email type settings"
        raise e
      end
    end

    def require_geocoder
      begin
        require 'geocoder'
        yield
      rescue LoadError => e
        e.message << " [rails_admin_settings] Please add gem 'validates_email_format_of' to your Gemfile to use email type settings"
        raise e
      end
    end

    def require_addressable
      begin
        require 'addressable/uri'
        yield
      rescue LoadError => e
        e.message << " [rails_admin_settings] Please add gem 'addressable' to your Gemfile to use url/domain type settings"
        raise e
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_admin_settings-0.5.0 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.4.3 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.4.2 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.4.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.4.0 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.3.9 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.3.8 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.3.7 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.3.6 lib/rails_admin_settings/require_helpers.rb