"Mills Thomas (app1tam)" <app1tam / ups.com> wrote: > I checked out some of the new Ruby features at theluckystiff.net and saw > 'ducktype'ing. It sounds uber cool. Is this what is meant by ducktype? > (The code may be inelegant; I don't know; I'm still a Ruby Nuby). Please > correct me if I got it wrong. > > def ducktype (x, y) > !(!( x.map{|f| break false if !y.respond_to?(f) })) > end More elegantly in 1.8 x.all? {|f| y.respond_to?(f)} martin