Class: Profile

Inherits:
Object
  • Object
show all
Defined in:
app/models/profile.rb

Instance Method Summary collapse

Constructor Details

#initialize(profileable) ⇒ Profile

Returns a new instance of Profile.



2
3
4
# File 'app/models/profile.rb', line 2

def initialize(profileable)
  @profileable = profileable
end

Instance Method Details

#fieldsObject



13
14
15
# File 'app/models/profile.rb', line 13

def fields
  profile_fields
end

#profile_fieldsObject



10
11
12
# File 'app/models/profile.rb', line 10

def profile_fields
  @profileable.profile_fields
end

#profileableObject



6
7
8
# File 'app/models/profile.rb', line 6

def profileable
  @profileable
end

#section(title) ⇒ Object



23
24
25
# File 'app/models/profile.rb', line 23

def section(title)
  section_by_title(title)
end

#section_by_title(title) ⇒ Object



27
28
29
# File 'app/models/profile.rb', line 27

def section_by_title(title)
  sections_by_title([title]).first
end

#sectionsObject



17
18
19
20
21
# File 'app/models/profile.rb', line 17

def sections
  @profileable.profile_section_titles.collect do |title|
    section_by_title(title)
  end
end

#sections_by_title(titles) ⇒ Object



30
31
32
33
34
# File 'app/models/profile.rb', line 30

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