Class: Live::View

Inherits:
Element show all
Defined in:
lib/live/view.rb

Instance Attribute Summary

Attributes inherited from Element

#id

Instance Method Summary collapse

Methods inherited from Element

#bind, #forward, #handle, #initialize, #rpc

Constructor Details

This class inherits a constructor from Live::Element

Instance Method Details

#append!(node) ⇒ Object



32
33
34
# File 'lib/live/view.rb', line 32

def append!(node)
	rpc(:append, [@id, node.to_html])
end

#prepend!(node) ⇒ Object



36
37
38
# File 'lib/live/view.rb', line 36

def prepend!(node)
	rpc(:prepend, [@id, node.to_html])
end

#render(builder) ⇒ Object



40
41
# File 'lib/live/view.rb', line 40

def render(builder)
end

#replace!Object



28
29
30
# File 'lib/live/view.rb', line 28

def replace!
	rpc(:replace, [@id, self.to_html])
end

#to_htmlObject



43
44
45
46
47
48
49
# File 'lib/live/view.rb', line 43

def to_html
	Trenni::Builder.fragment do |builder|
		builder.tag :div, id: @id, class: 'live', data: @data do
			render(builder)
		end
	end
end