Class: Faq::Section

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

Instance Method Summary collapse

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

Instance Method Details

#name_htmlObject



20
# File 'app/models/faq.rb', line 20

def name_html; Faq.markdown @name end