Sha256: 2e576f3c8857b4ac1616e61de8d0a0784d2b007aaa90e3fb61cd0cb726fe8e23
Contents?: true
Size: 882 Bytes
Versions: 10
Compression:
Stored size: 882 Bytes
Contents
module Licensee # Exposes #conditions, #permissions, and #limitation arrays of LicenseRules class LicenseRules < Struct.new(:conditions, :permissions, :limitations) include Licensee::HashHelper HASH_METHODS = Rule.groups class << self def from_license(license) from_meta(license.meta) end def from_meta(meta) rules = {} Rule.groups.each do |group| rules[group] = (meta[group] || []).map do |tag| Rule.find_by_tag_and_group(tag, group) end end from_hash(rules) end def from_hash(hash) ordered_array = hash.values_at(*members.map(&:to_s)) new(*ordered_array) end end def flatten members.map { |m| public_send(m) }.flatten end def key?(key) members.include?(key.to_sym) end alias has_key? key? end end
Version data entries
10 entries across 10 versions & 1 rubygems