Sha256: 3c6d6c4c8bbe331a9ff4bb5ec7f62c4a425c81912389b0ede7687621b8b78c53

Contents?: true

Size: 284 Bytes

Versions: 10

Compression:

Stored size: 284 Bytes

Contents

# -*- encoding : utf-8 -*-
module LoyalCore
  class ArrayUtil
    def self.extract_options!(arr)
      if arr.last.is_a?(Hash)
        arr.pop
      else
        {}
      end
    end

    def self.init args
      args.is_a?(Array) ? args : (args.nil? ? [] : [args])
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
loyal_core-0.0.11 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.10 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.8 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.7 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.6 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.5 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.4 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.3 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.2 lib/loyal_core/utils/array_util.rb
loyal_core-0.0.1 lib/loyal_core/utils/array_util.rb