Class: ActiveWarehouse::Builder::Generator::NameGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/active_warehouse/builder/generator/name_generator.rb

Overview

Generate a name consisting of one or more words from word groups

Instance Method Summary collapse

Instance Method Details

#next(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/active_warehouse/builder/generator/name_generator.rb', line 6

def next(options={})
  options[:separator] ||= ' '
  parts = []
  word_groups = options[:word_groups]
  0.upto(word_groups.first.length) do |i|
    word_groups.each do |word_group|
      parts << word_group[i]
    end
  end
  parts.join(options[:separator])
end