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.



8
9
10
11
12
13
# File 'lib/icalendar/downcased_hash.rb', line 8

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

Instance Method Details

#[](key) ⇒ Object



19
20
21
# File 'lib/icalendar/downcased_hash.rb', line 19

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

#[]=(key, value) ⇒ Object



15
16
17
# File 'lib/icalendar/downcased_hash.rb', line 15

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

#delete(key, &block) ⇒ Object



29
30
31
# File 'lib/icalendar/downcased_hash.rb', line 29

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

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

Returns:

  • (Boolean)


23
24
25
# File 'lib/icalendar/downcased_hash.rb', line 23

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