class RpgNaming::Base

Public Class Methods

new(min = 2, max = nil) click to toggle source
# File lib/rpg_naming.rb, line 6
def initialize(min = 2, max = nil)
  @min, @max = min, max
end

Public Instance Methods

member() click to toggle source
# File lib/rpg_naming.rb, line 14
def member
  select_range(RpgNaming.names.values_at("males", "females").flatten).sample
end

Private Instance Methods

pluralize(word) click to toggle source
# File lib/rpg_naming.rb, line 26
def pluralize(word)
  # FIXME
  word.concat("s")
end
select_range(objects) click to toggle source
# File lib/rpg_naming.rb, line 20
def select_range(objects)
  objects.select do |o|
    @min <= o.length && (@max.nil? || o.length <= @max)
  end
end