Module: CanTango::Permits::License::Loader

Included in:
CanTango::Permits::License
Defined in:
lib/cantango/permits/license/loader.rb

Instance Method Summary collapse

Instance Method Details

#load_rules(name = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cantango/permits/license/loader.rb', line 4

def load_rules name = nil
  return if !licenses || licenses.permissions.empty?
  name ||= self.class.to_s.gsub(/License$/, "").underscore

  return if licenses.permissions[name].nil?

  licenses.permissions[name].can_eval do |permission_statement|
    instance_eval permission_statement
  end
  licenses.permissions[name].cannot_eval do |permission_statement|
    instance_eval permission_statement
  end
end