OpenStruct class provided by the ostruct library makes it even easier.
# Create data objects without specifying the attributes # Create attributes on the fly: require 'ostruct' person = OpenStruct.new person.name = "Tom" person.age = 25