Module: Blackcal::ArrayUtil

Defined in:
lib/blackcal/array_util.rb

Overview

Time utils module

Class Method Summary collapse

Class Method Details

.flatten(data) ⇒ Array

Parameters:

  • data (Array, Array<#to_a>, Object)

Returns:

  • (Array)


8
9
10
11
12
13
# File 'lib/blackcal/array_util.rb', line 8

def self.flatten(data)
  Array(data).map do |object|
    next object.to_a if object.respond_to?(:to_a)
    object
  end.flatten(1)
end