Class: Pipl::Language

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

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, #is_searchable?, #to_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 = {}) ⇒ Language

Returns a new instance of Language.


629
630
631
632
633
634
# File 'lib/pipl/fields.rb', line 629

def initialize(params={})
  super params
  @language = params[:language]
  @region = params[:region]
  @display = params[:display]
end

Instance Attribute Details

#displayObject

Returns the value of attribute display.


627
628
629
# File 'lib/pipl/fields.rb', line 627

def display
  @display
end

#languageObject

Returns the value of attribute language.


627
628
629
# File 'lib/pipl/fields.rb', line 627

def language
  @language
end

#regionObject

Returns the value of attribute region.


627
628
629
# File 'lib/pipl/fields.rb', line 627

def region
  @region
end

Instance Method Details

#to_sObject


636
637
638
639
640
641
# File 'lib/pipl/fields.rb', line 636

def to_s
  return @display if @display
  return "#{@language}_#{@region}" if @language and @region
  return @language if @language and not @language.empty?
  @region
end