require 'traits' # # a hash argument can be used to specify default values # class C has 'a' => 4, :b => 2 end o = C::new print o.a, o.b, "\n" # # and these traits are smartly inherited # class K < C; end o = K::new o.a = 40 p( o.a + o.b ) # note that we pick up a default b from C class here since it # has not been set o.a = 42 o.b = nil p( o.b || o.a ) # but not here since we've explicitly set it to nil