Skip to content

Instantly share code, notes, and snippets.

View pokle's full-sized avatar

Tushar Pokle pokle

View GitHub Profile
@pokle
pokle / RubyStructs.irb
Created November 22, 2009 12:14
How to use Structs in Ruby
% irb
>> struct = Struct.new('Fabulous', :name, :id)
=> Struct::Fabulous
>> struct
=> Struct::Fabulous
>> class Foo < Struct::Fabulous
>> end
=> nil
>> f = Foo.new
=> #<struct Foo name=nil, id=nil>