Module: CanTango::Permits::Permit::ClassMethods

Included in:
CanTango::Permits::Permit
Defined in:
lib/cantango/permits/permit/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#account_name(clazz) ⇒ Object



13
14
15
16
# File 'lib/cantango/permits/permit/class_methods.rb', line 13

def  clazz
  return nil if clazz.name == clazz.name.demodulize
  clazz.name.gsub(/::.*/,'').gsub(/(.*)Permits/, '\1').underscore.to_sym
end

#first_name(clazz) ⇒ Object



5
6
7
# File 'lib/cantango/permits/permit/class_methods.rb', line 5

def first_name clazz
  clazz.to_s.gsub(/^([A-Za-z]+).*/, '\1').underscore.to_sym # first part of class name
end

#hash_keyObject



18
19
20
# File 'lib/cantango/permits/permit/class_methods.rb', line 18

def hash_key
  nil
end

#typeObject



9
10
11
# File 'lib/cantango/permits/permit/class_methods.rb', line 9

def type
  :abstract
end