Class: RubyApp::Elements::List::ClickedEvent

Inherits:
RubyApp::Element::Event show all
Defined in:
lib/ruby_app/elements/list.rb

Instance Attribute Summary collapse

Attributes inherited from RubyApp::Element::Event

#now, #source

Instance Method Summary collapse

Methods inherited from RubyApp::Element::Event

#add_class, #alert, #confirm_refresh, #execute, from_hash, #go, #hide, #process!, #refresh, #remove_class, #set_cookie, #show, #today, #update_element, #update_text, #update_value

Methods included from Mixins::TranslateMixin

#localize, #translate

Constructor Details

#initialize(data) ⇒ ClickedEvent

Returns a new instance of ClickedEvent.



17
18
19
20
21
# File 'lib/ruby_app/elements/list.rb', line 17

def initialize(data)
  super(data)
  @index = data['index'].to_i
  @item = self.source.items[@index]
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



15
16
17
# File 'lib/ruby_app/elements/list.rb', line 15

def index
  @index
end

#itemObject (readonly)

Returns the value of attribute item.



15
16
17
# File 'lib/ruby_app/elements/list.rb', line 15

def item
  @item
end

Instance Method Details

#to_hashObject



23
24
25
# File 'lib/ruby_app/elements/list.rb', line 23

def to_hash
  super.merge('index' => @index)
end