Sha256: 5583f0ba576367c0b90abf7bfea0fee4fd425e397b875ba2652d5388745dc3f8

Contents?: true

Size: 1.09 KB

Versions: 32

Compression:

Stored size: 1.09 KB

Contents

module IceNine
  class Freezer
    def self.find(name)
      freezer = name.split('::').reduce(self) do |mod, const|
        mod.const_lookup(const) or break mod # rubocop:disable Style/AndOr
      end
      freezer if freezer < self # only return a descendant freezer
    end

    class ObjectWithExclussion < Object
      class_attribute :excluded_vars
      self.excluded_vars = []
      def self.freeze_instance_variables(object, recursion_guard)
        object.instance_variables.each do |ivar_name|
          next if excluded_vars.include? ivar_name
          Freezer.guarded_deep_freeze(
            object.instance_variable_get(ivar_name),
            recursion_guard
          )
        end
      end
      private_class_method :freeze_instance_variables
    end

    class ActiveScaffold < ::IceNine::Freezer::Object
      class DataStructures < ::IceNine::Freezer::Object
        class Column < ::IceNine::Freezer::ObjectWithExclussion
          self.excluded_vars = %i[@active_record_class @column]
        end

        class Association < ::IceNine::Freezer::NoFreeze
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
active_scaffold-3.7.11 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.10 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.8 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.7 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.6 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.5 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.2 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.1 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.7.0 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.20 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.19 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.17 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.15 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.14 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.13 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.12 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.11.1 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.11 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.10 lib/active_scaffold/extensions/ice_nine.rb
active_scaffold-3.6.9 lib/active_scaffold/extensions/ice_nine.rb