Class: CreateTable::ColumnNameBasedCollection
- Inherits:
-
Delegator
- Object
- Delegator
- CreateTable::ColumnNameBasedCollection
- Defined in:
- lib/create_table/column_name_based_collection.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create ⇒ Object
5 6 7 |
# File 'lib/create_table/column_name_based_collection.rb', line 5 def create new([]) end |
Instance Method Details
#[](column_names) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/create_table/column_name_based_collection.rb', line 18 def [](column_names) return if column_names.nil? k = [column_names].flatten retval = @items.select { |i| i.column_names == k } raise "oops #{k.inspect}: #{retval.map(&:column_names).inspect}" if retval.length > 1 retval.first end |
#__getobj__ ⇒ Object
10 11 12 |
# File 'lib/create_table/column_name_based_collection.rb', line 10 def __getobj__ @items end |
#__setobj__(items) ⇒ Object
14 15 16 |
# File 'lib/create_table/column_name_based_collection.rb', line 14 def __setobj__(items) @items = items end |