Class: StaticGenderizer::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/static_genderizer/result.rb

Overview

Simple result object returned by analyze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_names:, last_names:, language:, gender:) ⇒ Result

first_names, last_names: arrays of original tokens (preserve original casing) language: symbol or nil (language that best matched) gender: :male, :female, :unknown



11
12
13
14
15
16
# File 'lib/static_genderizer/result.rb', line 11

def initialize(first_names:, last_names:, language:, gender:)
  @first_names = Array(first_names)
  @last_names = Array(last_names)
  @language = language
  @gender = gender
end

Instance Attribute Details

#first_namesObject (readonly)

Returns the value of attribute first_names.



6
7
8
# File 'lib/static_genderizer/result.rb', line 6

def first_names
  @first_names
end

#genderObject (readonly)

Returns the value of attribute gender.



6
7
8
# File 'lib/static_genderizer/result.rb', line 6

def gender
  @gender
end

#languageObject (readonly)

Returns the value of attribute language.



6
7
8
# File 'lib/static_genderizer/result.rb', line 6

def language
  @language
end

#last_namesObject (readonly)

Returns the value of attribute last_names.



6
7
8
# File 'lib/static_genderizer/result.rb', line 6

def last_names
  @last_names
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
25
# File 'lib/static_genderizer/result.rb', line 18

def to_h
  {
    first_names: first_names,
    last_names: last_names,
    language: language,
    gender: gender
  }
end