Class: Pipl::Username

Inherits:
Field
  • Object
show all
Defined in:
lib/pipl/fields.rb

Direct Known Subclasses

UserID

Instance Attribute Summary collapse

Attributes inherited from Field

#current, #inferred, #last_seen, #valid_since

Instance Method Summary collapse

Methods inherited from Field

base_params_from_hash, extra_metadata, from_hash

Methods included from Utils

alnum_chars, alpha_chars, date_to_str, extract_rate_limits, is_valid_url?, str_to_date, titleize, to_utf8

Constructor Details

#initialize(params = {}) ⇒ Username

Returns a new instance of Username.



422
423
424
425
# File 'lib/pipl/fields.rb', line 422

def initialize(params={})
  super params
  @content = params[:content]
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



420
421
422
# File 'lib/pipl/fields.rb', line 420

def content
  @content
end

Instance Method Details

#is_searchable?Boolean

Returns:

  • (Boolean)


431
432
433
# File 'lib/pipl/fields.rb', line 431

def is_searchable?
  !@content.nil? && Pipl::Utils.alnum_chars(@content).length > 2
end

#to_hashObject



427
428
429
# File 'lib/pipl/fields.rb', line 427

def to_hash
  {content: @content} if @content
end