Sha256: e40dc53271f97ad0b9285d259097307763022a560d7963f9c9f11327b9bc78a6
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'natives/catalog/normalizer' module Natives class Catalog class Selector def initialize(hash) @values = normalize(hash) end def values_for(package_provider, platform, platform_version) package_provider = package_provider.to_s platform = platform.to_s platform_version = platform_version.to_s values = if @values.key?(package_provider) && @values[package_provider].key?(platform) && @values[package_provider][platform].key?(platform_version) @values[package_provider][platform][platform_version] elsif @values.key?(package_provider) && @values[package_provider].key?(platform) && @values[package_provider][platform].key?('default') @values[package_provider][platform]['default'] elsif @values.key?(package_provider) && @values[package_provider].key?('default') @values[package_provider]['default'] end Array(values) end private def normalize(hash) Normalizer.new.normalize(hash) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
natives-0.6.2 | lib/natives/catalog/selector.rb |
natives-0.6.1 | lib/natives/catalog/selector.rb |