Sha256: 93406aea8e171e7d82467070f54e442ff5cb1f8e670ed348da5af073525eef5a

Contents?: true

Size: 1.65 KB

Versions: 20

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 kind 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 kind 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 kind settings"
        raise e
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rails_admin_settings-1.3.2 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.3.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.3.0 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.2.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.2.0 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.1.4 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.1.3 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.1.2 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.1.0.pre.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.0.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.0.0 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-1.0.0.pre.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.1 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0.pre.6 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0.pre.5 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0.pre.4 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0.pre.3 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0.pre.2 lib/rails_admin_settings/require_helpers.rb
rails_admin_settings-0.9.0.pre lib/rails_admin_settings/require_helpers.rb