Sha256: ecc03adc586e4326d24668705d5deedc135914a6e022eabc5b5a6d3081fd321b

Contents?: true

Size: 647 Bytes

Versions: 19

Compression:

Stored size: 647 Bytes

Contents

# frozen_string_literal: true

require_relative 'default'
require_relative '../helpers/hash'

module NanoBot
  module Logic
    module Cartridge
      module Fetch
        def self.cascate(cartridge, paths)
          results = paths.map { |path| Helpers::Hash.fetch(cartridge, path) }
          result = results.find { |candidate| !candidate.nil? }
          return result unless result.nil?

          results = paths.map { |path| Helpers::Hash.fetch(Default.instance.values, path) }
          result = results.find { |candidate| !candidate.nil? }
          return result unless result.nil?

          nil
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
nano-bots-3.4.0 logic/cartridge/fetch.rb
nano-bots-3.3.0 logic/cartridge/fetch.rb
nano-bots-3.2.0 logic/cartridge/fetch.rb
nano-bots-3.0.1 logic/cartridge/fetch.rb
nano-bots-3.0.0 logic/cartridge/fetch.rb
nano-bots-2.5.1 logic/cartridge/fetch.rb
nano-bots-2.5.0 logic/cartridge/fetch.rb
nano-bots-2.4.1 logic/cartridge/fetch.rb
nano-bots-2.4.0 logic/cartridge/fetch.rb
nano-bots-2.3.0 logic/cartridge/fetch.rb
nano-bots-2.2.0 logic/cartridge/fetch.rb
nano-bots-2.1.0 logic/cartridge/fetch.rb
nano-bots-2.0.0 logic/cartridge/fetch.rb
nano-bots-1.2.0 logic/cartridge/fetch.rb
nano-bots-1.1.2 logic/cartridge/fetch.rb
nano-bots-1.1.1 logic/cartridge/fetch.rb
nano-bots-1.1.0 logic/cartridge/fetch.rb
nano-bots-1.0.1 logic/cartridge/fetch.rb
nano-bots-1.0.0 logic/cartridge/fetch.rb