Class: FAQML::DetailsFilter

Inherits:
Temple::Filter
  • Object
show all
Defined in:
lib/fml/details_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DetailsFilter

Returns a new instance of DetailsFilter.



2
3
4
# File 'lib/fml/details_filter.rb', line 2

def initialize(options = {})
  @options = options
end

Instance Method Details

#call(exp) ⇒ Object



6
7
8
# File 'lib/fml/details_filter.rb', line 6

def call(exp)
  compile(exp)
end

#on_fml_qna(question, answer = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fml/details_filter.rb', line 10

def on_fml_qna(question, answer=nil)
  answer_sexp = !answer.nil? && answer.length >= 4 ? build_fml_details('answer', true, answer[2], answer[3]) : nil
  question_sexp = build_fml_details('question', false, question[2], question[3])
  question_sexp.last << answer_sexp unless answer_sexp.nil?
  [:html, :tag, 'section', [:html, :attrs, [:html, :attr, 'class', [:static, 'qna']]],
    question_sexp
  ]
end