Method: CrateAPI::Items.from_array

Defined in:
lib/crate_api/items.rb

.from_array(array) ⇒ Array

Creates an array of Item objects.

Parameters:

  • array (Array)

    to be used as the generation source.

Returns:

  • (Array)

    either an empty array if the input array is nil or a fully inialized array of Item objects.



15
16
17
18
19
20
21
22
# File 'lib/crate_api/items.rb', line 15

def self.from_array(array)
  return [] unless array != nil
  files = Array.new
  array.each do |file|
    files.push(Item.new(file))
  end
  return files
end