From: Trans Date: 2005-02-01T03:20:46+09:00 Subject: Should every method have a module method? I'm looking at some the Rail's support methods to see what Facets can gain from it. The following gives me pause (slightly simplified for your inspection): | module Inflector | extend self | | def pluralize(word) | result = word.to_s.dup | plural_rules.each do |(rule, replacement)| | break if result.gsub!(rule, replacement) | end | return result | end | ... | | | class String | module Inflections | def pluralize | Inflector.pluralize(self) | end | ... | | class String | include Inflections | end Is all this really neccessary? Are these methods really ever usful for anything else but Strings and derivatives thereof? --What would you include them in? And would you ever really be more inclined to write: Inflector.pluralize(a) over a.pluralize Perhaps some people use Ruby in completely non-OOP ways. I guess they would appriciate this design. If so should that be something we should always try to accomodate? Thanks, T