Class: Dill::Table::Columns
- Inherits:
-
Object
- Object
- Dill::Table::Columns
- Includes:
- Enumerable
- Defined in:
- lib/dill/widgets/table.rb
Instance Method Summary collapse
- #[](header_or_index) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(parent) ⇒ Columns
constructor
A new instance of Columns.
Constructor Details
#initialize(parent) ⇒ Columns
Returns a new instance of Columns.
30 31 32 |
# File 'lib/dill/widgets/table.rb', line 30 def initialize(parent) @parent = parent end |
Instance Method Details
#[](header_or_index) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dill/widgets/table.rb', line 34 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
46 47 48 |
# File 'lib/dill/widgets/table.rb', line 46 def each(&block) parent.each(&block) end |