Class: Licensee::LicenseRules
- Inherits:
-
Struct
- Object
- Struct
- Licensee::LicenseRules
- Defined in:
- lib/licensee/license_rules.rb
Overview
Exposes #conditions, #permissions, and #limitation arrays of LicenseRules
Instance Attribute Summary collapse
-
#conditions ⇒ Object
Returns the value of attribute conditions.
-
#limitations ⇒ Object
Returns the value of attribute limitations.
-
#permissions ⇒ Object
Returns the value of attribute permissions.
Class Method Summary collapse
Instance Method Summary collapse
- #flatten ⇒ Object
- #key?(key) ⇒ Boolean (also: #has_key?)
Instance Attribute Details
#conditions ⇒ Object
Returns the value of attribute conditions
3 4 5 |
# File 'lib/licensee/license_rules.rb', line 3 def conditions @conditions end |
#limitations ⇒ Object
Returns the value of attribute limitations
3 4 5 |
# File 'lib/licensee/license_rules.rb', line 3 def limitations @limitations end |
#permissions ⇒ Object
Returns the value of attribute permissions
3 4 5 |
# File 'lib/licensee/license_rules.rb', line 3 def end |
Class Method Details
.from_hash(hash) ⇒ Object
19 20 21 22 |
# File 'lib/licensee/license_rules.rb', line 19 def from_hash(hash) ordered_array = hash.values_at(*members.map(&:to_s)) new(*ordered_array) end |
.from_license(license) ⇒ Object
5 6 7 |
# File 'lib/licensee/license_rules.rb', line 5 def from_license(license) (license.) end |
.from_meta(meta) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/licensee/license_rules.rb', line 9 def () rules = {} Rule.groups.each do |group| rules[group] = [group].map do |tag| Rule.find_by_tag_and_group(tag, group) end end from_hash(rules) end |
Instance Method Details
#flatten ⇒ Object
25 26 27 |
# File 'lib/licensee/license_rules.rb', line 25 def flatten members.map { |m| public_send(m) }.flatten end |
#key?(key) ⇒ Boolean Also known as: has_key?
29 30 31 |
# File 'lib/licensee/license_rules.rb', line 29 def key?(key) members.include?(key.to_sym) end |