method_missing

require 'test/unit'

class PropertyTest < Test::Unit::TestCase
  def test_proerty
    pro = Customer.new    
    pro.name = "halu01"
    pro.age = 16
    pro.hogehoge = "myhoge"    
    assert_equal("halu01", pro.name)
    assert_equal(16, pro.age)
    assert_equal("myhoge", pro.hogehoge)
  end
end

module Property
  def initialize
    @values = Hash.new
  end
  def method_missing(method, *value)
    if(setter_method?(method))
      key = method.id2name.delete("=")
      @values[key] = value[0]
    else
      key = method.id2name
      return @values[key]
    end
  end  
  def setter_method?(method)
    method.id2name.include?("=")
  end
end

class Customer
  include Property
end