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

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@shingara

shingara commented Dec 9, 2012

If you want not freeze some namespace you can do

IceNine.no_freeze([RSpec, Mocha])

fixed #2

@mbj

This comment has been minimized.

Show comment
Hide comment
@mbj

mbj Dec 9, 2012

Collaborator

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
Collaborator

mbj commented Dec 9, 2012

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

This comment has been minimized.

Show comment
Hide comment
@shingara

shingara Dec 9, 2012

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

shingara commented Dec 9, 2012

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

lib/ice_nine.rb
@@ -42,4 +42,12 @@ def self.deep_freeze(object)
end
end
+ def self.no_freeze(mods)

This comment has been minimized.

@dkubb

dkubb Dec 10, 2012

Owner

You could write this as def self.no_freeze(*mods), then you wouldn't have to use Array(mods) below.

@dkubb

dkubb Dec 10, 2012

Owner

You could write this as def self.no_freeze(*mods), then you wouldn't have to use Array(mods) below.

@dkubb

This comment has been minimized.

Show comment
Hide comment
@dkubb

dkubb Dec 10, 2012

Owner

@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.

Owner

dkubb commented Dec 10, 2012

@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

This comment has been minimized.

Show comment
Hide comment
@shingara

shingara Dec 10, 2012

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

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

@mbj

This comment has been minimized.

Show comment
Hide comment
@mbj

mbj Jan 11, 2015

Collaborator

Closing this PR for no activity.

Collaborator

mbj commented Jan 11, 2015

Closing this PR for no activity.

@mbj mbj closed this Jan 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment