Class: Quby::Questionnaires::Entities::Item

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, ActiveSupport::Callbacks
Defined in:
lib/quby/questionnaires/entities/item.rb

Direct Known Subclasses

Panel, Question, Table, Text

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Item

Returns a new instance of Item.



19
20
21
22
# File 'lib/quby/questionnaires/entities/item.rb', line 19

def initialize(options = {})
  @raw_content = options[:raw_content]
  @switch_cycle = options[:switch_cycle] || false
end

Instance Attribute Details

#presentationObject



24
25
26
# File 'lib/quby/questionnaires/entities/item.rb', line 24

def presentation
  @presentation || "vertical"
end

#raw_contentObject

Raw content may contain a raw HTML replacement for this item



17
18
19
# File 'lib/quby/questionnaires/entities/item.rb', line 17

def raw_content
  @raw_content
end

#switch_cycleObject

Returns the value of attribute switch_cycle.



14
15
16
# File 'lib/quby/questionnaires/entities/item.rb', line 14

def switch_cycle
  @switch_cycle
end

Instance Method Details

#as_json(options = {}) ⇒ Object



28
29
30
31
32
# File 'lib/quby/questionnaires/entities/item.rb', line 28

def as_json(options = {})
  {
    class: self.class.to_s
  }
end