Sha256: b28896039d2cf60202e18b76596506e33b20df3f3c6b62756aeaf772c94c38ce

Contents?: true

Size: 672 Bytes

Versions: 89

Compression:

Stored size: 672 Bytes

Contents

module ActiveFedora 
  class Config
    attr_reader :credentials
    def initialize(val)
      if val.is_a? Array
        init_shards(val)
      else 
        init_single(val)
      end
    end

    def sharded?
      credentials.is_a? Array
    end

    private

    def init_shards(vals)
        @credentials = vals.map(&:symbolize_keys)
    end

    def init_single(vals)
        @credentials = vals.symbolize_keys
        unless @credentials.has_key?(:user) && @credentials.has_key?(:password) && @credentials.has_key?(:url)
          raise ActiveFedora::ConfigurationError, "Fedora configuration must provide :user, :password and :url."
        end
    end
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/active_fedora/config.rb
active-fedora-8.6.0 lib/active_fedora/config.rb
active-fedora-8.5.0 lib/active_fedora/config.rb
active-fedora-8.4.2 lib/active_fedora/config.rb
active-fedora-8.4.1 lib/active_fedora/config.rb
active-fedora-7.3.1 lib/active_fedora/config.rb
active-fedora-7.3.0 lib/active_fedora/config.rb
active-fedora-8.4.0 lib/active_fedora/config.rb
active-fedora-8.3.0 lib/active_fedora/config.rb
active-fedora-8.2.2 lib/active_fedora/config.rb
active-fedora-8.2.1 lib/active_fedora/config.rb
active-fedora-8.2.0 lib/active_fedora/config.rb
active-fedora-7.2.0 lib/active_fedora/config.rb
active-fedora-6.8.0 lib/active_fedora/config.rb
active-fedora-8.1.0 lib/active_fedora/config.rb
active-fedora-8.0.1 lib/active_fedora/config.rb
active-fedora-8.0.0 lib/active_fedora/config.rb
active-fedora-8.0.0.rc3 lib/active_fedora/config.rb
active-fedora-8.0.0.rc2 lib/active_fedora/config.rb
active-fedora-8.0.0.rc1 lib/active_fedora/config.rb