Class: Icalendar::DowncasedHash

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/icalendar/downcased_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ DowncasedHash

Returns a new instance of DowncasedHash.


6
7
8
9
10
11
# File 'lib/icalendar/downcased_hash.rb', line 6

def initialize(base)
  super Hash.new
  base.each do |key, value|
    self[key] = value
  end
end

Instance Method Details

#[](key) ⇒ Object


17
18
19
# File 'lib/icalendar/downcased_hash.rb', line 17

def [](key)
  __getobj__[key.to_s.downcase]
end

#[]=(key, value) ⇒ Object


13
14
15
# File 'lib/icalendar/downcased_hash.rb', line 13

def []=(key, value)
  __getobj__[key.to_s.downcase] = value
end

#delete(key, &block) ⇒ Object


27
28
29
# File 'lib/icalendar/downcased_hash.rb', line 27

def delete(key, &block)
  __getobj__.delete key.to_s.downcase, &block
end

#has_key?(key) ⇒ Boolean Also known as: include?, member?

Returns:

  • (Boolean)

21
22
23
# File 'lib/icalendar/downcased_hash.rb', line 21

def has_key?(key)
  __getobj__.has_key? key.to_s.downcase
end