Class: WillPaginate::Deprecation::Hash

Inherits:
Hash
  • Object
show all
Defined in:
lib/will_paginate/deprecation.rb

Instance Method Summary collapse

Constructor Details

#initialize(values = {}) ⇒ Hash

Returns a new instance of Hash.



23
24
25
26
27
# File 'lib/will_paginate/deprecation.rb', line 23

def initialize(values = {})
  super()
  update values
  @deprecated = {}
end

Instance Method Details

#[]=(key, value) ⇒ Object



29
30
31
32
# File 'lib/will_paginate/deprecation.rb', line 29

def []=(key, value)
  check_deprecated(key, value)
  super
end

#deprecate_key(*keys, &block) ⇒ Object



34
35
36
37
# File 'lib/will_paginate/deprecation.rb', line 34

def deprecate_key(*keys, &block)
  message = block_given? ? block : keys.pop
  Array(keys).each { |key| @deprecated[key] = message }
end

#merge(another) ⇒ Object



39
40
41
# File 'lib/will_paginate/deprecation.rb', line 39

def merge(another)
  to_hash.update(another)
end

#to_hashObject



43
44
45
# File 'lib/will_paginate/deprecation.rb', line 43

def to_hash
  ::Hash.new.update(self)
end