Sha256: 2f9eca9635db5059c84bf7dc6932dc41a1a4b5964a6c88421bec615c5cf9654c

Contents?: true

Size: 538 Bytes

Versions: 183

Compression:

Stored size: 538 Bytes

Contents

module Spree
  module Core
    module EnvironmentExtension
      extend ActiveSupport::Concern

      def add_class(name)
        self.instance_variable_set "@#{name}", Set.new

        create_method( "#{name}=".to_sym ) { |val|
          instance_variable_set( "@" + name, val)
        }

        create_method(name.to_sym) do
          instance_variable_get( "@" + name )
        end
      end

      private

        def create_method(name, &block)
          self.class.send(:define_method, name, &block)
        end
    end
  end
end

Version data entries

183 entries across 183 versions & 3 rubygems

Version Path
spree_core-1.1.0 lib/spree/core/environment_extension.rb
spree_core-1.1.0.rc2 lib/spree/core/environment_extension.rb
spree_core-1.1.0.rc1 lib/spree/core/environment_extension.rb