Displaying 1 result from an estimated 1 matches for "is_two_word".
Did you mean:
is_two_words
2007 Nov 27
0
Working with one model from another
...Base
# Work some magic -- let''s populate the instance using the raw name
string (e.g. "Honda Civic")
def magically_understand(name_string)
raw_name = RawName.new(name_string)
if raw_name.is_one_word then
self.make = raw_name.contents
else
if raw_name.is_two_words then
self.make = raw_name.words.first
self.model = raw_name.words.last
end
end
if raw_name.make_could_be_japanese then
self.origin_country = "Japan"
end
return true
end
end
###################
# models/raw_name.rb #
###################
cl...