Class: AttributeSection
Instance Method Summary
collapse
Methods inherited from BaseSection
#insert_anchor_before_end, #remove_anchors, #set_content_to_template
Constructor Details
#initialize(target, binding_name) ⇒ AttributeSection
7
8
9
10
|
# File 'lib/volt/page/targets/attribute_section.rb', line 7
def initialize(target, binding_name)
@target = target
@binding_name = binding_name
end
|
Instance Method Details
#html=(value) ⇒ Object
16
17
18
|
# File 'lib/volt/page/targets/attribute_section.rb', line 16
def html=(value)
set_content_and_rezero_bindings(value, {})
end
|
32
33
34
35
36
|
# File 'lib/volt/page/targets/attribute_section.rb', line 32
def remove
node = @target.find_by_binding_id(@binding_name)
node.remove if node
end
|
#set_content_and_rezero_bindings(html, bindings) ⇒ Object
Takes in our html and bindings, and rezero’s the comment names, and the bindings. Returns an updated bindings hash
22
23
24
25
26
27
28
29
30
|
# File 'lib/volt/page/targets/attribute_section.rb', line 22
def set_content_and_rezero_bindings(html, bindings)
if @binding_name == 'main'
@target.html = html
else
@target.find_by_binding_id(@binding_name).html = html
end
return bindings
end
|
#text=(text) ⇒ Object
12
13
14
|
# File 'lib/volt/page/targets/attribute_section.rb', line 12
def text=(text)
set_content_and_rezero_bindings(text, {})
end
|