Sha256: 7a1ebc3e2fcbbaff09f5df8030e54e10005a48d21f3a1504592bb3ca9b79c959

Contents?: true

Size: 1.69 KB

Versions: 8

Compression:

Stored size: 1.69 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".freeze
        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".freeze
        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".freeze
        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".freeze
        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".freeze
        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".freeze
        raise e
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ack_rails_admin_settings-1.2.1.3 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.2.1.2 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.2.1.1 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.2.1 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.2.0.2 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.2.0.1 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.1.5 lib/rails_admin_settings/require_helpers.rb
ack_rails_admin_settings-1.1.4 lib/rails_admin_settings/require_helpers.rb