class Licensee::LicenseRules
Exposes conditions, permissions, and limitation arrays of LicenseRules
Constants
- HASH_METHODS
Public Class Methods
from_hash(hash)
click to toggle source
# File lib/licensee/license_rules.rb, line 24 def from_hash(hash) ordered_array = hash.values_at(*members.map(&:to_s)) new(*ordered_array) end
from_license(license)
click to toggle source
# File lib/licensee/license_rules.rb, line 10 def from_license(license) from_meta(license.meta) end
from_meta(meta)
click to toggle source
# File lib/licensee/license_rules.rb, line 14 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
Public Instance Methods
flatten()
click to toggle source
# File lib/licensee/license_rules.rb, line 30 def flatten members.map { |m| public_send(m) }.flatten end
key?(key)
click to toggle source
# File lib/licensee/license_rules.rb, line 34 def key?(key) members.include?(key.to_sym) end
Also aliased as: has_key?