Skip to content

Instantly share code, notes, and snippets.

@weapp
Created July 21, 2014 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weapp/3d61bcf241e8240e4be5 to your computer and use it in GitHub Desktop.
Save weapp/3d61bcf241e8240e4be5 to your computer and use it in GitHub Desktop.
require "ostruct"
obj = OpenStruct.new(a: "a", b: "b", to_ary: ["a", "b"] )
a, b = obj
puts "a: #{a}"
puts "b: #{b}"
obj = OpenStruct.new(a: "a", b: "b")
def obj.to_ary
["wadus", "yadus"]
end
a, b = obj
puts "a: #{a}"
puts "b: #{b}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment