Class: Capybara::UI::Table::Columns

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/capybara/ui/widgets/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Columns

Returns a new instance of Columns.


31
32
33
# File 'lib/capybara/ui/widgets/table.rb', line 31

def initialize(parent)
  @parent = parent
end

Instance Method Details

#[](header_or_index) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
# File 'lib/capybara/ui/widgets/table.rb', line 35

def [](header_or_index)
  case header_or_index
  when Integer
    values_by_index(header_or_index)
  when String
    values_by_header(header_or_index)
  else
    raise TypeError,
          "can't convert #{header_or_index.inspect} to Integer or String"
  end
end

#each(&block) ⇒ Object


47
48
49
# File 'lib/capybara/ui/widgets/table.rb', line 47

def each(&block)
  parent.each(&block)
end