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-3.2.9 lib/spree/core/environment_extension.rb
spree_core-3.1.14 lib/spree/core/environment_extension.rb
spree_core-3.3.6 lib/spree/core/environment_extension.rb
spree_core-3.2.8 lib/spree/core/environment_extension.rb
spree_core-3.1.13 lib/spree/core/environment_extension.rb
spree_core-3.3.5 lib/spree/core/environment_extension.rb
spree_core-3.3.4 lib/spree/core/environment_extension.rb
spree_core-3.2.7 lib/spree/core/environment_extension.rb
spree_core-3.1.12 lib/spree/core/environment_extension.rb
solidus_core-1.2.3 lib/spree/core/environment_extension.rb
solidus_core-1.1.4 lib/spree/core/environment_extension.rb
solidus_core-1.0.7 lib/spree/core/environment_extension.rb
spree_core-3.3.3 lib/spree/core/environment_extension.rb
spree_core-3.2.6 lib/spree/core/environment_extension.rb
spree_core-3.1.11 lib/spree/core/environment_extension.rb
spree_core-3.1.10 lib/spree/core/environment_extension.rb
spree_core-3.3.2 lib/spree/core/environment_extension.rb
spree_core-3.2.5 lib/spree/core/environment_extension.rb
spree_core-3.1.9 lib/spree/core/environment_extension.rb
spree_core-3.3.1 lib/spree/core/environment_extension.rb