Class: Faq::Section
- Inherits:
-
Object
- Object
- Faq::Section
- Defined in:
- app/models/faq.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Section
constructor
A new instance of Section.
- #name_html ⇒ Object
Constructor Details
#initialize(args) ⇒ Section
Returns a new instance of Section.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/faq.rb', line 7 def initialize args @name = args[:name] @items = args[:item].map do |v| if ['subtitle'] == v.keys Subtitle.new v['subtitle'] elsif ['q', 'a'] == v.keys QAPair.new q: v['q'], a: v['a'] else raise "Item #{v} did not match subtitle or QApair format" end end end |