Class: Cucumber::Salad::Widgets::List

Inherits:
Widget
  • Object
show all
Includes:
Enumerable
Defined in:
lib/cucumber/salad/widgets/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

find_in, #has_action?, #initialize, #inspect, present_in?, #reload, root, selector, #to_s

Methods included from Cucumber::Salad::WidgetMacros

#action, #widget, #widget_delegator

Methods included from Cucumber::Salad::WidgetContainer

#has_widget?, #widget

Constructor Details

This class inherits a constructor from Cucumber::Salad::Widgets::Widget

Class Method Details

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



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cucumber/salad/widgets/list.rb', line 11

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



25
26
27
# File 'lib/cucumber/salad/widgets/list.rb', line 25

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