dkubb / ice_nine

Deep Freeze Ruby Objects
MIT License
307 stars 19 forks source link

Add method to simplest the NoFreeze system by adding a class method #4

Closed shingara closed 9 years ago

shingara commented 11 years ago

If you want not freeze some namespace you can do

IceNine.no_freeze([RSpec, Mocha])

fixed #2

mbj commented 11 years ago

I really like to get the problem solved, but I do not like we are dynamically modifying global state. Also when this state is the class hierarchy of IceNine.

What about a factory that returns an IceNine / Adamantium module that behaves like we want?

module MyApp
  Immutable = Adamantium.build(:no_freeze => [...], :memoizer => :freeze, ...)

  class DomainEntity
    include Immutable
  end
end
shingara commented 11 years ago

I test the code with const_set and seems not work in regard of my spec

dkubb commented 11 years ago

@mbj that's an interesting case. I do lean toward figuring out how to do what you suggest, it's much nicer for testing and keeps things out of global state. Maybe we should all discuss how that would work and if it makes sense here or in Adamantium.

shingara commented 11 years ago

I rebase my pull request with all of comment do on previous pull request

mbj commented 9 years ago

Closing this PR for no activity.