Sha256: 6a6c1fcdb3519c07d75b84a7f4a31ff09d6326f4f9f8b9f3b7cad0a786809cc6

Contents?: true

Size: 1.65 KB

Versions: 22

Compression:

Stored size: 1.65 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

22 entries across 22 versions & 1 rubygems

Version Path
rails_admin_settings-0.5.3 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.5.2 lib/rails_admin_settings/require_helpers.rb