app/providers/naming_provider.rb in rumm-0.0.21 vs app/providers/naming_provider.rb in rumm-0.0.22

- old
+ new

@@ -4,12 +4,12 @@ def value self end - def generate_name(first_letter = random_letter, last_letter = random_letter) - "#{adjective first_letter}-#{noun last_letter}" + def generate_name(adj_first_letter = nil, noun_first_letter = nil) + "#{adjective adj_first_letter}-#{noun noun_first_letter}" end def random_letter ('a'..'z').to_a.shuffle.first end @@ -24,14 +24,18 @@ def dictionary_file File.expand_path '../naming/dictionary.pstore', __FILE__ end def noun(first_letter) - list = dictionary('nouns')[first_letter] - list[rand(list.length - 1)] + word 'nouns', first_letter end def adjective(first_letter) - list = dictionary('adjectives')[first_letter] + word 'adjectives', first_letter + end + + def word(type, first_letter) + first_letter ||= random_letter + list = dictionary(type)[first_letter] list[rand(list.length - 1)] end end