require 'traits' # # defining a trait is like attr_accessor in the simple case # class C trait :t end o = C::new o.t = 42 p o.t # # and can be made even shorter # class B; has :x; end o = B::new o.x = 42 p o.x