Class: Lobbyliste::Person

Inherits:
Object show all
Defined in:
lib/lobbyliste/person.rb

Overview

Class to encapsulate a person.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, titles, original_name) ⇒ Person

Returns a new instance of Person.



14
15
16
17
18
# File 'lib/lobbyliste/person.rb', line 14

def initialize(name, titles, original_name)
  @name = name
  @titles = titles
  @original_name = original_name
end

Instance Attribute Details

#nameString (readonly)

Returns the persons name (hopefully) stripped of all titles.

Returns:

  • (String)

    the persons name (hopefully) stripped of all titles



6
7
8
# File 'lib/lobbyliste/person.rb', line 6

def name
  @name
end

#original_nameString (readonly)

Returns the original name with titles as stated in the document.

Returns:

  • (String)

    the original name with titles as stated in the document



12
13
14
# File 'lib/lobbyliste/person.rb', line 12

def original_name
  @original_name
end

#titlesArray (readonly)

Returns list of all titles (job, academic, positions).

Returns:

  • (Array)

    list of all titles (job, academic, positions)



9
10
11
# File 'lib/lobbyliste/person.rb', line 9

def titles
  @titles
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
# File 'lib/lobbyliste/person.rb', line 20

def ==(other)
  original_name==other.original_name
end

#to_json(*a) ⇒ Object



24
25
26
27
28
29
# File 'lib/lobbyliste/person.rb', line 24

def to_json(*a)
  {
      name: name,
      titles: titles
  }.to_json(*a)
end