Path: | TODO |
Last Update: | Tue Feb 15 02:09:44 Westeuropäische Normalzeit 2005 |
adaption :from => Pathname, :to => String, :via => :to_str adaption :from => String, :to => Pathname do |string| Pathname.new(string) end adaption :from => String, :to => Pathname, :via => Pathname.method(:new)
Perhaps make both :from and :to default to self so short forms are possible inside classes: (raise Exception when :to == :from)
class String adaption :to => Pathname, :via => Pathname.method(:new) adaption :from => Pathname, :via => :to_str adaption :to => Symbol, :via => :to_sym end
Might be nice to have conditional adaption routes:
class Object adaption :to => String, :via => :to_str, :if => Contract::Check::Quack[:to_str] # perhaps also introduce this short form adaption :to => String, :via => :to_str, :if => :to_str end
Perhaps :if should default to :via if :via is a Symbol which would allow the above to become
class Object adaption :to => String, :via => :to_str end