Class: Caixanegra::UnitHelper
- Inherits:
-
Object
- Object
- Caixanegra::UnitHelper
- Defined in:
- lib/caixanegra/unit_helper.rb
Class Method Summary collapse
Class Method Details
.all_units ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/caixanegra/unit_helper.rb', line 17 def all_units units = {} Caixanegra.units.each do |unit| units[unit.name.demodulize.underscore.to_sym] = unit end units end |
.scoped_units(scope) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/caixanegra/unit_helper.rb', line 4 def scoped_units(scope) units = {} scopes = (scope || "").split(",").map(&:to_sym) Caixanegra.units.each do |unit| if unit.scope.nil? || unit.scope.any? { |checking_scope| scopes.include?(checking_scope) } units[unit.name.demodulize.underscore.to_sym] = unit end end units end |