class Quby::Questionnaires::Entities::Text

Attributes

col_span[RW]

In case of being displayed inside a table, amount of columns/rows to span

display_in[RW]
row_span[RW]
str[R]

Public Class Methods

new(str, options = {}) click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 17
def initialize(str, options = {})
  if options[:html_content]
    options[:raw_content] = "<div class='item text'>" + options[:html_content] + "</div>"
  end
  super(options)
  @str = str
  @html_content = options[:html_content]
  @display_in = options[:display_in] || [:paged]
  @col_span = options[:col_span] || 1
  @row_span = options[:row_span] || 1
end

Public Instance Methods

==(other) click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 53
def ==(other)
  case other.class
  when String
    text == other
  when self.class
    text == other.text
  else
    false
  end
end
as_json(options = {}) click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 29
def as_json(options = {})
  super().merge(text: text)
end
html() click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 33
def html
  @html_content || text
end
key() click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 41
def key
  't0'
end
text() click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 37
def text
  @text ||= Quby::MarkdownParser.new(str).to_html
end
to_s() click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 64
def to_s
  text
end
type() click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 45
def type
  "text"
end
validate_answer(answer_hash) click to toggle source
# File lib/quby/questionnaires/entities/text.rb, line 49
def validate_answer(answer_hash)
  true
end