Class: Gecko::Widget::Text
Defined Under Namespace
Classes: Item
Instance Attribute Summary
#data, #keys
Instance Method Summary
collapse
#config, #config!, #on_update, #payload, #push_requests, #push_url, #update
Constructor Details
#initialize(*args, &block) ⇒ Text
Returns a new instance of Text.
30
31
32
33
|
# File 'lib/gecko/widget/text.rb', line 30
def initialize(*args, &block)
super
@items = []
end
|
Instance Method Details
#[](index) ⇒ Object
48
49
50
|
# File 'lib/gecko/widget/text.rb', line 48
def [](index)
@items[index]
end
|
#[]=(index, *args) ⇒ Object
52
53
54
|
# File 'lib/gecko/widget/text.rb', line 52
def []=(index, *args)
@items[index] = Item.new(*args)
end
|
#add(*args) ⇒ Object
44
45
46
|
# File 'lib/gecko/widget/text.rb', line 44
def add(*args)
@items.push(Item.new(*args))
end
|
#data_payload ⇒ Object
60
61
62
63
64
|
# File 'lib/gecko/widget/text.rb', line 60
def data_payload
{
:item => self.map{ |item| {:text => item.text, :type => item.type} }
}
end
|
#delete(index) ⇒ Object
56
57
58
|
# File 'lib/gecko/widget/text.rb', line 56
def delete(index)
@items.delete_at(index)
end
|
#each(&block) ⇒ Object
40
41
42
|
# File 'lib/gecko/widget/text.rb', line 40
def each(&block)
@items.each(&block)
end
|
#reset ⇒ Object
35
36
37
38
|
# File 'lib/gecko/widget/text.rb', line 35
def reset
@items.clear
self
end
|