Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/core_ext.rb
Instance Method Summary collapse
-
#after(time) ⇒ Object
Filters elements, collecting those whose times are after time.
-
#before(time) ⇒ Object
Filters elements, collecting those whose times are before time.
-
#in(time) ⇒ Object
The ‘in’ is just sugar really, saving the programmer from doing a trivial computation over and over again in their code.
Instance Method Details
#after(time) ⇒ Object
Filters elements, collecting those whose times are after time
10 11 12 |
# File 'lib/core_ext.rb', line 10 def after time select {|t| t.expdepart >= Time.parse(time) } end |
#before(time) ⇒ Object
Filters elements, collecting those whose times are before time
4 5 6 |
# File 'lib/core_ext.rb', line 4 def before time select {|t| t.expdepart <= Time.parse(time) } end |
#in(time) ⇒ Object
The ‘in’ is just sugar really, saving the programmer from doing a trivial computation over and over again in their code.
17 18 19 20 21 |
# File 'lib/core_ext.rb', line 17 def in time select { |t| ((t.expdepart - t.query_time ) / 60) < time } end |