Module: CanTango::Permit::ClassMethods

Includes:
Helper::Naming
Included in:
Base
Defined in:
lib/cantango/permit/class_methods.rb

Instance Method Summary collapse

Methods included from Helper::Naming

#account_name, #permit_name, #permit_type

Instance Method Details

#finderObject



27
28
29
# File 'lib/cantango/permit/class_methods.rb', line 27

def finder
  @finder ||= CanTango::Finder::Permit::Base.new permit_name(self), :account => (self)
end

#hash_keyObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/cantango/permit/class_methods.rb', line 23

def hash_key
  raise NotImplementedError
end

#inherited(subclass) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/cantango/permit/class_methods.rb', line 4

def inherited(subclass)
  unless [CanTango::Permit::Base, CanTango::Permit::Attribute].include?(subclass.superclass)
    subclass.extend CanTango::Permit::ClassMethods
    register(subclass)
  else
    register_type subclass
  end        
end

#modes(*names) ⇒ Object



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

def modes *names
  @modes ||= []
  return @modes if names.empty?
  @modes = names.to_symbols
end

#typeObject



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

def type
  :abstract
end