Module: Licensee::LicenseAllHelper
- Defined in:
- lib/licensee/license.rb
Overview
Helpers used by Licensee::License.all for option normalization and filtering.
Class Method Summary collapse
- .apply_all_filters!(licenses, options) ⇒ Object
- .filter_featured(licenses, featured) ⇒ Object
- .normalize_all_options(options, defaults) ⇒ Object
Class Method Details
.apply_all_filters!(licenses, options) ⇒ Object
23 24 25 26 |
# File 'lib/licensee/license.rb', line 23 def apply_all_filters!(licenses, ) licenses.reject!(&:hidden?) unless [:hidden] licenses.reject!(&:pseudo_license?) unless [:pseudo] end |
.filter_featured(licenses, featured) ⇒ Object
28 29 30 31 32 |
# File 'lib/licensee/license.rb', line 28 def filter_featured(licenses, featured) return licenses if featured.nil? licenses.select { |l| l.featured? == featured } end |
.normalize_all_options(options, defaults) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/licensee/license.rb', line 16 def (, defaults) normalized = .dup # TODO: Remove in next major version to avoid breaking change normalized[:pseudo] = normalized[:psuedo] if normalized[:pseudo].nil? && !normalized[:psuedo].nil? defaults.merge(normalized) end |