Sha256: 5c199da7bd8f09752f2ca801cee9e7c00854be77eee59af1a62d3eab1c5a4fca
Contents?: true
Size: 909 Bytes
Versions: 3
Compression:
Stored size: 909 Bytes
Contents
require 'rubygems' require 'bundler/setup' require 'ruby-event' module RubyApp module Elements require 'ruby_app/element' class List < RubyApp::Element class SelectedEvent < RubyApp::Element::Event attr_reader :index, :item def initialize(data) super(data) @index = data['index'].to_i @item = self.source.items[@index] end def to_hash super.merge('index' => @index) end end template_path(:all, File.dirname(__FILE__)) attr_accessor :items event :selected def initialize super @items = [] end protected def on_event(event) on_selected(event) if event.is_a?(RubyApp::Elements::List::SelectedEvent) super(event) end def on_selected(event) selected(event) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
RubyApp-0.0.8 | lib/ruby_app/elements/list.rb |
RubyApp-0.0.7 | lib/ruby_app/elements/list.rb |
RubyApp-0.0.6 | lib/ruby_app/elements/list.rb |