class Pipl::Field
Attributes
current[RW]
inferred[RW]
last_seen[RW]
valid_since[RW]
Public Class Methods
base_params_from_hash(h)
click to toggle source
# File lib/pipl/fields.rb, line 28 def self.base_params_from_hash(h) params = { inferred: h[:@inferred], current: h[:@current], type: h[:@type], display: h[:display] } params[:valid_since] = Date.strptime(h[:@valid_since], Pipl::DATE_FORMAT) if h.key? :@valid_since params[:last_seen] = Date.strptime(h[:@last_seen], Pipl::DATE_FORMAT) if h.key? :@last_seen params[:date_range] = Pipl::DateRange.from_hash(h[:date_range]) if h.key? :date_range params end
extra_metadata()
click to toggle source
# File lib/pipl/fields.rb, line 41 def self.extra_metadata [] end
from_hash(h)
click to toggle source
# File lib/pipl/fields.rb, line 21 def self.from_hash(h) params = base_params_from_hash h extra_metadata.each { |p| params[p] = h["@#{p}".to_sym] } params = h.merge params self.new(params) end
new(params={})
click to toggle source
# File lib/pipl/fields.rb, line 14 def initialize(params={}) @valid_since = params[:valid_since] @last_seen = params[:last_seen] @inferred = params[:inferred] @current = params[:current] end
Public Instance Methods
is_searchable?()
click to toggle source
# File lib/pipl/fields.rb, line 49 def is_searchable? true end
to_hash()
click to toggle source
# File lib/pipl/fields.rb, line 45 def to_hash end