Sha256: b5cfe69248ae30a5cc68bf0d232b63cd1446fb2f7e9ed823ef6d3fe32df3fea2
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
module Belka class Company class <<self def name(opts = {}) ind = opts[:industries] || opts[:industry] || 3 industries = case ind when Numeric Belka.pick_multi(Data::Industries, ind) when Array ind when Symbol [ ind ] else raise ArgumentError end words = (industries << :common).map { |i| Data::CompanyNameParts[i] }.flatten last_word_variants = words.select { |w| !w.start_with?('-') } inner_word_variants = words.select { |w| !w.start_with?('$') } word_count = (opts[:solidity] || 1) + 1 last_word = Belka.pick(last_word_variants) parts = Belka.pick_multi(inner_word_variants - [last_word], word_count - 1) name = (parts << last_word).map { |w| w.sub(/^[-$]/, '') } * '' if rand(5) > 2 suffix = Belka.pick(Data::CompanyNameSuffixes) if suffix.start_with?('-') name << suffix else name = "#{name} #{suffix}" end end name end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
belka-0.0.4 | lib/belka/company.rb |
belka-0.0.2 | lib/belka/company.rb |