class Hash

Public Class Methods

make_accessible() click to toggle source
# File lib/accessible_hash/make_accessible.rb, line 16
def self.make_accessible
  def method_missing(method_name, *args)
    if method_name =~ /[a-zA-Z0-9]+=$/
      self[method_name.to_s.delete('=').to_sym] = args.first
    elsif keys.include? method_name
      self[method_name]
    else
      super(method_name, *args)
    end
  end
end
method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/accessible_hash/make_accessible.rb, line 4
def self.method_missing(method_name, *args)
  if method_name =~ /[a-zA-Z0-9]+=$/
    self[method_name.to_s.delete('=').to_sym] = args.first
  elsif keys.include? method_name
    self[method_name]
  else
    super(method_name, *args)
  end
end

Public Instance Methods

make_accessible() click to toggle source
# File lib/accessible_hash/make_accessible.rb, line 3
def make_accessible
  def self.method_missing(method_name, *args)
    if method_name =~ /[a-zA-Z0-9]+=$/
      self[method_name.to_s.delete('=').to_sym] = args.first
    elsif keys.include? method_name
      self[method_name]
    else
      super(method_name, *args)
    end
  end
  self
end
method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/accessible_hash/make_accessible.rb, line 17
def method_missing(method_name, *args)
  if method_name =~ /[a-zA-Z0-9]+=$/
    self[method_name.to_s.delete('=').to_sym] = args.first
  elsif keys.include? method_name
    self[method_name]
  else
    super(method_name, *args)
  end
end