Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/timeframe/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#multiple_timeframes_gaps_left_by(*time_frames) ⇒ Object

Constructs an array of timeframes representing the “gaps” left by the given array of timeframes.

To use this feature, you must explicitly require ‘timeframe/core_ext/array’



5
6
7
8
# File 'lib/timeframe/core_ext/array.rb', line 5

def multiple_timeframes_gaps_left_by(*time_frames)
  raise ArgumentError.new 'You can only use timeframe for this operation' unless [self + time_frames].flatten.all?{|el| el.is_a?(Timeframe)}
  self.inject([]){|a,b| a << b.gaps_left_by(*time_frames)}.flatten
end