Sha256: a0f9346ae0e1cfd07dac9722193319196d2c72df01d4cb6cf457bf774b41c63a

Contents?: true

Size: 525 Bytes

Versions: 9

Compression:

Stored size: 525 Bytes

Contents

module Spree
  module Core
    module EnvironmentExtension
      extend ActiveSupport::Concern

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

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

        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

9 entries across 9 versions & 1 rubygems

Version Path
spree_core-3.4.6 lib/spree/core/environment_extension.rb
spree_core-3.4.5 lib/spree/core/environment_extension.rb
spree_core-3.4.4 lib/spree/core/environment_extension.rb
spree_core-3.4.3 lib/spree/core/environment_extension.rb
spree_core-3.4.2 lib/spree/core/environment_extension.rb
spree_core-3.4.1 lib/spree/core/environment_extension.rb
spree_core-3.4.0 lib/spree/core/environment_extension.rb
spree_core-3.4.0.rc2 lib/spree/core/environment_extension.rb
spree_core-3.4.0.rc1 lib/spree/core/environment_extension.rb