Module: Enumerable

Defined in:
lib/cotcube-helpers/enum_ext.rb

Overview

Adding deep_freeze and deep_frozen?

Instance Method Summary collapse

Instance Method Details

#deep_freezeObject



24
25
26
27
28
29
30
# File 'lib/cotcube-helpers/enum_ext.rb', line 24

def deep_freeze
  unless @deep_frozen
    each(&:deep_freeze)
    @deep_frozen = true
  end
  freeze
end

#deep_frozen?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/cotcube-helpers/enum_ext.rb', line 32

def deep_frozen?
  !!@deep_frozen
end