Class: Profile
- Inherits:
-
Object
- Object
- Profile
- Defined in:
- app/models/profile.rb
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(profileable) ⇒ Profile
constructor
A new instance of Profile.
- #profile_fields ⇒ Object
- #profileable ⇒ Object
- #section(title) ⇒ Object
- #section_by_title(title) ⇒ Object
- #sections ⇒ Object
- #sections_by_title(titles) ⇒ Object
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
#fields ⇒ Object
13 14 15 |
# File 'app/models/profile.rb', line 13 def fields profile_fields end |
#profile_fields ⇒ Object
10 11 12 |
# File 'app/models/profile.rb', line 10 def profile_fields @profileable.profile_fields end |
#profileable ⇒ Object
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 |
#sections ⇒ Object
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 |