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.
421 422 423 424 |
# File 'lib/pipl/fields.rb', line 421 def initialize(params={}) super params @content = params[:content] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
419 420 421 |
# File 'lib/pipl/fields.rb', line 419 def content @content end |
Instance Method Details
#is_searchable? ⇒ Boolean
430 431 432 |
# File 'lib/pipl/fields.rb', line 430 def is_searchable? !@content.nil? and Pipl::Utils.alnum_chars(@content).length > 3 end |
#to_hash ⇒ Object
426 427 428 |
# File 'lib/pipl/fields.rb', line 426 def to_hash {content: @content} if @content end |