Sha256: 5ea6477f44cc0768b96ad8f07df37aa9363df37d619631e39046c792af64a241

Contents?: true

Size: 933 Bytes

Versions: 10

Compression:

Stored size: 933 Bytes

Contents

module WashOut
  module Configurable
    extend ActiveSupport::Concern

    included do
      cattr_reader :soap_config
      class_variable_set :@@soap_config, WashOut::SoapConfig.new({})
    end

    module ClassMethods

      def soap_config=(obj)

        unless obj.is_a?(Hash)
          raise "Value needs to be a Hash."
        end

        if class_variable_defined?(:@@soap_config)
          class_variable_get(:@@soap_config).configure obj
        else
          class_variable_set :@@soap_config, WashOut::SoapConfig.new(obj)
        end
      end
    end

    def soap_config=(obj)

      unless obj.is_a?(Hash)
        raise "Value needs to be a Hash."
      end

      class_eval do
        if class_variable_defined?(:@@soap_config)
          class_variable_get(:@@soap_config).configure obj
        else
          class_variable_set :@@soap_config, WashOut::SoapConfig.new(obj)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
wash-out-0.10.1 lib/wash_out/configurable.rb
wash_out-0.12.0 lib/wash_out/configurable.rb
wash_out-0.11.0 lib/wash_out/configurable.rb
wash_out-0.11.0.beta.2 lib/wash_out/configurable.rb
wash_out-0.11.0.beta.1 lib/wash_out/configurable.rb
wash_out-0.10.0 lib/wash_out/configurable.rb
wash_out-0.9.2 lib/wash_out/configurable.rb
wash_out-0.9.0 lib/wash_out/configurable.rb
wash_out-0.9.0.beta.2 lib/wash_out/configurable.rb
wash_out-0.9.0.beta.1 lib/wash_out/configurable.rb