Sha256: 8c52529c1e065c1a333456d2110faae9028a84992047bea890e6c44e3426ade9

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

module WashOutFork
  module Configurable
    extend ActiveSupport::Concern

    included do
      cattr_reader :soap_config
      class_variable_set :@@soap_config, WashOutFork::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, WashOutFork::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, WashOutFork::SoapConfig.new(obj)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wash_out_fork-0.0.1 lib/wash_out_fork/configurable.rb