class GClouderUndefinedResources::LocalResources
Public Class Methods
new(file)
click to toggle source
# File lib/gclouder_undefined_resources/local_resources.rb, line 7 def initialize(file) @resources = yaml_load(file) end
Public Instance Methods
global?(key, name)
click to toggle source
# File lib/gclouder_undefined_resources/local_resources.rb, line 20 def global?(key, name) return false if key.empty? #ap @resources #puts "looking up: #{key}, name: #{name}" match = @resources.dig(*key) return false if match.nil? found_resources = match.select { |hash| hash["name"] == name } !found_resources.empty? #rescue => error # puts "#{error}: #{key}:#{name}" # exit 1 end
regional?(region, key, name)
click to toggle source
# File lib/gclouder_undefined_resources/local_resources.rb, line 33 def regional?(region, key, name) return false if key.empty? #ap @resources #puts "looking up: #{key}, name: #{name}" match = @resources.dig("regions", region, *key) return false if match.nil? found_resources = match.select { |hash| hash["name"] == name } !found_resources.empty? #rescue => error # puts "#{error}: #{key}:#{name}" # exit 1 end
yaml_load(file)
click to toggle source
# File lib/gclouder_undefined_resources/local_resources.rb, line 13 def yaml_load(file) @resources = YAML.load_file(file) rescue => e puts "failed to load local resource file: #{e}" exit 1 end