Sha256: a79185cda97a433335ae9fcd4b4e6e51d617f1275a1a157099d64840ca25cf10

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

class Profile
  def initialize(profileable)
    @profileable = profileable
  end
  
  def profileable
    @profileable
  end
  
  def profile_fields
    @profileable.profile_fields
  end
  def fields
    profile_fields
  end
  
  def sections
    @profileable.profile_section_titles.collect do |title|
      section_by_title(title)
    end
  end
  
  def section(title)
    section_by_title(title)
  end

  def section_by_title(title)
    sections_by_title([title]).first
  end
  def sections_by_title(titles)
    titles.collect do |title|
      ProfileSection.new( title: title, profileable: @profileable )
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 app/models/profile.rb
your_platform-1.0.0 app/models/profile.rb
your_platform-0.0.2 app/models/profile.rb