Welcome!  login or register

Your great ideas will be born here
language: Ruby (ruby 1.8.7)
date: 273 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
require 'ostruct'
 
hash = {'bar'=>'baz', 'apple'=>'banana', 'cat'=>'dog'}
 
new_hash = OpenStruct.new(hash)
 
puts new_hash.bar
puts new_hash.apple
puts new_hash.cat
 
 
  • upload with new input

  • result: Success     time: 0.01s    memory: 5000 kB     returned value: 0       Would you like to manage your submissions?
    Sign up now and enjoy the full functionality of Ideone.

    baz
    banana
    dog