blob: 2335358835c48c38f740fa69cf50399929a28ca1 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# 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
|