Sha256: 1cd02c0d03c2142a6cd60812e8ff45446d12d65cd15698456a1aa92c1315cc1b
Contents?: true
Size: 967 Bytes
Versions: 19
Compression:
Stored size: 967 Bytes
Contents
# frozen_string_literal: true require_relative '../helpers/hash' require_relative 'default' module NanoBot module Logic module Cartridge module Adapter def self.expression(cartridge, interface, direction, language) adapter = [ { exists: (Helpers::Hash.fetch(cartridge, [:interfaces, direction, :adapter]) || {}).key?(language), value: Helpers::Hash.fetch(cartridge, [:interfaces, direction, :adapter, language]) }, { exists: (Helpers::Hash.fetch(cartridge, [:interfaces, interface, direction, :adapter]) || {}).key?(language), value: Helpers::Hash.fetch(cartridge, [:interfaces, interface, direction, :adapter, language]) } ].filter { |candidate| candidate[:exists] }.last return nil if adapter.nil? adapter[:value] end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems