Class: Dill::List

Inherits:
Widget show all
Includes:
Enumerable
Defined in:
lib/dill/list.rb

Constant Summary collapse

DEFAULT_TYPE =
Widget

Instance Attribute Summary

Attributes inherited from Widget

#root

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Widget

#!=, #==, action, find_in, #has_action?, #initialize, #inspect, present_in?, #reload, root, selector, #to_f, #to_i, #to_s, widget, widget_delegator

Methods included from WidgetContainer

#has_widget?, #widget

Constructor Details

This class inherits a constructor from Dill::Widget

Class Method Details

.item(selector, type = DEFAULT_TYPE, &item_for) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dill/list.rb', line 9

def self.item(selector, type = DEFAULT_TYPE, &item_for)
  define_method :item_selector do
    @item_selector ||= selector
  end

  if block_given?
    define_method :item_for, &item_for
  else
    define_method :item_factory do
      type
    end
  end
end

Instance Method Details

#to_tableObject



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

def to_table
  items.map { |e| Array(e) }
end