Sha256: 5603a7586b9cc3b7a69c7fece016b41ba864df995b2a548e53dd819b0971d6e4

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

module DelayedSunspot
  module Sunspot
    class Configuration
      def initialize(config)
        @config = config
        singleton = (class <<self; self; end)
        @properties = @config.instance_variable_get("@properties") || {}
        @properties.keys.each do |key|
          singleton.module_eval do
            define_method key do
              if @properties[key].is_a?(LightConfig::Configuration)
                self.class.new(@properties[key])
              else
                @properties[key]
              end
            end
            define_method "#{key}=" do |value|
              @properties[key] = value
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
delayed_sunspot-0.1.0 lib/delayed_sunspot/sunspot/configuration.rb