Sha256: 26f920457fe6b4182eb662f5377f6a41ad037d350dc4525b3dfb1d765173a868

Contents?: true

Size: 555 Bytes

Versions: 1

Compression:

Stored size: 555 Bytes

Contents

module Gendered
  class NameList
    include Enumerable

    attr_reader :names

    def initialize(values)
      @names = Array(values).collect do |value|
        case value
        when String then Name.new(value)
        when Name then value
        end
      end
    end

    def guess!
      Guesser.new(names).guess!
      names.collect(&:gender)
    end

    def each(&block)
      names.each do |name|
        block.call name
      end
    end

    def [](value)
      names.find do |name|
        name.value == value
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gendered-0.0.1 lib/gendered/name_list.rb