Sha256: 41a3a64135adb8ce398e153ab699b0097bd2597bb09d7bbf4e6874907a5e3bb8

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

require 'date'

class Biography < Hashie::Trash
  include Hashie::Extensions::IgnoreUndeclared

  @split_on_comma = ->(i) { i.is_a?(Array) ? i : i.split(', ') }
  @parse_date     = ->(i) { Date.parse(i) }

  property :first_name
  property :middle_name
  property :last_name
  property :maiden_name
  property :full_name_at_birth
  property :other_names # array
  property :age, transform_with: ->(i) { i.to_i }
  property :born_on, from: :date_of_birth, transform_with: @parse_date
  property :born_at, from: :birthplace
  property :height
  property :weight
  property :description
  property :build
  property :eye_color
  property :hair_color
  property :distinctive_features # array
  property :star_sign
  property :sexuality
  property :religion
  property :ethnicity
  property :nationality
  property :high_school
  property :occupation
  property :occupation_category
  property :claim_to_fame # array
  property :talent_agency
  property :brand_endorsements # array
  property :measurements_inches
  property :dress_size
  property :shoe_size
  property :websites, from: :official_website # array
  property :father
  property :mother
  property :brothers # array
  property :sisters # array
  property :friends, transform_with: @split_on_comma
  property :pets # array
  property :favorite_movies, transform_with: @split_on_comma
  property :favorite_places
  property :favorite_foods,  transform_with: @split_on_comma
  property :favorite_colors, transform_with: @split_on_comma
  property :favorite_accessories
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whos_dated_who-1.0.4 lib/whos_dated_who/biography.rb
whos_dated_who-1.0.3 lib/whos_dated_who/biography.rb
whos_dated_who-1.0.2 lib/whos_dated_who/biography.rb
whos_dated_who-1.0.1 lib/whos_dated_who/biography.rb
whos_dated_who-1.0.0 lib/whos_dated_who/biography.rb