class Duedil::Struct

Attributes

hash[R]

Public Class Methods

new() click to toggle source
# File lib/duedil/struct.rb, line 5
def initialize
  @hash = {}
end

Public Instance Methods

[](key) click to toggle source
# File lib/duedil/struct.rb, line 9
def [](key)
  @hash[key]
end
[]=(key, value) click to toggle source
# File lib/duedil/struct.rb, line 13
def []=(key, value)
  @hash[key] = value
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/duedil/struct.rb, line 17
def method_missing(name, *args, &block)
  key = name.to_s.gsub(/_(\w)/) { $1.capitalize }

  if @hash.has_key?(key) && args.empty? && block.nil?
    @hash[key]
  else
    super name, *args, &block
  end
end
respond_to_missing?(name, include_private = false) click to toggle source
# File lib/duedil/struct.rb, line 27
def respond_to_missing?(name, include_private = false)
  @hash.has_key?(name.to_s.gsub(/_(\w)/) { $1.capitalize })
end