Class: Pipl::Username
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Attributes inherited from Field
#current, #inferred, #last_seen, #valid_since
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Username
constructor
A new instance of Username.
- #is_searchable? ⇒ Boolean
- #to_hash ⇒ Object
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
#content ⇒ Object
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
431 432 433 |
# File 'lib/pipl/fields.rb', line 431 def is_searchable? !@content.nil? && Pipl::Utils.alnum_chars(@content).length > 2 end |
#to_hash ⇒ Object
427 428 429 |
# File 'lib/pipl/fields.rb', line 427 def to_hash {content: @content} if @content end |