Class: Quby::Compiler::Entities::InfoBlock

Inherits:
Item
  • Object
show all
Defined in:
lib/quby/compiler/entities/info_block.rb

Instance Attribute Summary collapse

Attributes inherited from Item

#presentation, #raw_content, #switch_cycle

Instance Method Summary collapse

Methods inherited from Item

#as_json

Constructor Details

#initialize(key:, panel:, start_open: true, subtype: "info") ⇒ InfoBlock

Returns a new instance of InfoBlock.



12
13
14
15
16
17
18
# File 'lib/quby/compiler/entities/info_block.rb', line 12

def initialize(key:, panel:, start_open: true, subtype: "info")
  @panel = panel
  @key = key
  @start_open = start_open
  @subtype = subtype
  @items = []
end

Instance Attribute Details

#htmlObject

Returns the value of attribute html.



6
7
8
# File 'lib/quby/compiler/entities/info_block.rb', line 6

def html
  @html
end

#itemsObject (readonly)

Returns the value of attribute items.



5
6
7
# File 'lib/quby/compiler/entities/info_block.rb', line 5

def items
  @items
end

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/quby/compiler/entities/info_block.rb', line 5

def key
  @key
end

#panelObject (readonly)

Returns the value of attribute panel.



5
6
7
# File 'lib/quby/compiler/entities/info_block.rb', line 5

def panel
  @panel
end

#start_openObject (readonly)

Returns the value of attribute start_open.



5
6
7
# File 'lib/quby/compiler/entities/info_block.rb', line 5

def start_open
  @start_open
end

#subtypeObject (readonly)

Returns the value of attribute subtype.



5
6
7
# File 'lib/quby/compiler/entities/info_block.rb', line 5

def subtype
  @subtype
end

Instance Method Details

#indexObject



20
21
22
# File 'lib/quby/compiler/entities/info_block.rb', line 20

def index
  panel.items.index(self)
end

#path_strObject



28
29
30
# File 'lib/quby/compiler/entities/info_block.rb', line 28

def path_str
  "#{panel.questionnaire.key}:InfoBlock:#{key}"
end

#typeObject



24
25
26
# File 'lib/quby/compiler/entities/info_block.rb', line 24

def type
  "info"
end