Sha256: 9087b8888fd5d7b896ce2bfbe4ed33c81bccd64a75f7c62c01ef3202ddbe4e1f

Contents?: true

Size: 503 Bytes

Versions: 8

Compression:

Stored size: 503 Bytes

Contents

module EnvironmentExtension
  extend ActiveSupport::Concern

  module InstanceMethods

    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 ) { 
        instance_variable_get( "@" + name ) 
      }
    end

    private

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

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spree_core-0.70.7 lib/environment_extension.rb
spree_core-0.70.6 lib/environment_extension.rb
spree_core-0.70.5 lib/environment_extension.rb
spree_core-0.70.4 lib/environment_extension.rb
spree_core-0.70.3 lib/environment_extension.rb
spree_core-0.70.2 lib/environment_extension.rb
spree_core-0.70.1 lib/environment_extension.rb
spree_core-0.70.0 lib/environment_extension.rb