class Pipl::Job
Attributes
date_range[RW]
display[RW]
industry[RW]
organization[RW]
title[RW]
Public Class Methods
new(params={})
click to toggle source
Calls superclass method
Pipl::Field::new
# File lib/pipl/fields.rb, line 311 def initialize(params={}) super params @title = params[:title] @organization = params[:organization] @industry = params[:industry] @date_range = params[:date_range] @display = params[:display] end
Public Instance Methods
to_hash()
click to toggle source
# File lib/pipl/fields.rb, line 320 def to_hash {title: @title, organization: @organization, industry: @industry, 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 326 def to_s return @display if @display if @title and @organization s = @title + ' at ' + @organization else s = @title || @organization end if s and @industry if @date_range range = @date_range.years_range s += ' (%s, %d-%d)' % [@industry, range[0], range[1]] else s += ' (%s)' % [@industry] end else s = ((s || '') + ' ' + (@industry || '')).strip if s and @date_range range = @date_range.years_range s += ' (%d-%d)' % [range[0], range[1]] end end s ? Pipl::Utils.to_utf8(s) : '' end