Class: Pipl::Gender
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Attributes inherited from Field
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Gender
constructor
A new instance of Gender.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Methods inherited from Field
base_params_from_hash, extra_metadata, from_hash, #is_searchable?
Methods included from Utils
alnum_chars, alpha_chars, date_to_str, is_valid_url?, str_to_date, titleize, to_utf8
Constructor Details
#initialize(params = {}) ⇒ Gender
Returns a new instance of Gender.
558 559 560 561 562 563 |
# File 'lib/pipl/fields.rb', line 558 def initialize(params={}) super params raise ArgumentError.new("#{params[:content]} is not a valid gender") \ unless %w(male female).include? params[:content] @content = params[:content] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
556 557 558 |
# File 'lib/pipl/fields.rb', line 556 def content @content end |
Instance Method Details
#to_hash ⇒ Object
569 570 571 |
# File 'lib/pipl/fields.rb', line 569 def to_hash {content: @content} if @content end |
#to_s ⇒ Object
565 566 567 |
# File 'lib/pipl/fields.rb', line 565 def to_s Pipl::Utils.titleize @content if @content end |