class Pipl::Education

Attributes

date_range[RW]
degree[RW]
display[RW]
school[RW]

Public Class Methods

new(params={}) click to toggle source
Calls superclass method Pipl::Field::new
# File lib/pipl/fields.rb, line 360
def initialize(params={})
  super params
  @degree = params[:degree]
  @school = params[:school]
  @date_range = params[:date_range]
  @display = params[:display]
end

Public Instance Methods

to_hash() click to toggle source
# File lib/pipl/fields.rb, line 368
def to_hash
  {degree: @degree, school: @school, date_range: @date_range ? @date_range.to_hash : nil}
      .reject { |_, value| value.nil? }
end
to_s() click to toggle source
# File lib/pipl/fields.rb, line 373
def to_s
  return @display if @display

  if @degree and @school
    s = @degree + ' from ' + @school
  else
    s = @degree || @school
  end

  if s and @date_range
    range = @date_range.years_range
    s += ' (%d-%d)' % [range[0], range[1]]
  end

  s ? Pipl::Utils.to_utf8(s) : ''
end