Sha256: 60a621af169cfe0b15d25e6d8d53771ef94c7117ac5beb51f6ad0218f371975f

Contents?: true

Size: 472 Bytes

Versions: 2

Compression:

Stored size: 472 Bytes

Contents

module NameGen
  class MarkovGenerator
    def initialize
      @elements_collection = File.read(File.join(File.dirname(__FILE__),
                                                 '..', '..', 'config',
                                                 'syllable.txt')).split
    end

    def get_name(elements)
      result_name = []

      elements.times do
        result_name << @elements_collection.sample
      end

      result_name.join.capitalize
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
name_gen-0.3.0 lib/name_gen/markov_generator.rb
name_gen-0.2.1 lib/name_gen/markov_generator.rb