Sha256: cae3b2fe2c65a1079e2a55d8260c7b180256a7b4b57af158be7bea6bdc4454b3
Contents?: true
Size: 809 Bytes
Versions: 9
Compression:
Stored size: 809 Bytes
Contents
module Licensee # Exposes #conditions, #permissions, and #limitation arrays of LicenseRules class LicenseRules < Struct.new(:conditions, :permissions, :limitations) 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
9 entries across 9 versions & 1 rubygems