lib/under_os/ui/collection.rb in under-os-1.0.0 vs lib/under_os/ui/collection.rb in under-os-1.1.0
- old
+ new
@@ -12,11 +12,11 @@
@_.registerClass(Cell, forCellWithReuseIdentifier:'UOSCollectionCell')
end
def on(*args, &block)
super *args do |event|
- params = [event.item, event.index, event.section].compact
+ params = [event.item, event.index, event.section]
params = params.slice(0, block.arity) if block.arity > -1
block.call *params
end
end
@@ -38,17 +38,19 @@
Cell.classes[self] = klass
end
def reload
@_.reloadData
+ self
end
def number_of_items(section=0)
(@number_of_items || [0])[section]
end
def number_of_items=(value)
@number_of_items = value.is_a?(Numeric) ? [value] : value
+ reload
end
def number_of_sections
(@number_of_items || [0]).size
end