Class: Hystorical::RubyCollection
- Inherits:
-
Object
- Object
- Hystorical::RubyCollection
- Defined in:
- lib/hystorical/ruby_collection.rb
Class Method Summary collapse
Class Method Details
.current(collection) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/hystorical/ruby_collection.rb', line 5 def current(collection) collection.select do |obj| current = get_attr(obj, :end_date).nil? block_given? ? (yield obj) && current : current end end |
.current_on(collection, date) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/hystorical/ruby_collection.rb', line 12 def current_on(collection, date) collection.select do |obj| current = (get_attr(obj, :start_date) <= date) && (get_attr(obj, :end_date) >= date) block_given? ? (yield obj) && current : current end end |