Module: Wakari::Support::Naming::ClassMethods

Defined in:
lib/wakari/models/support/naming.rb

Instance Method Summary collapse

Instance Method Details

#_to_partial_pathObject

:nodoc:



35
36
37
38
39
# File 'lib/wakari/models/support/naming.rb', line 35

def _to_partial_path #:nodoc:
  @_to_partial_path ||= begin
    "#{model_name.collection}/#{model_name.element}".freeze
  end
end

#model_nameObject



41
42
43
44
45
46
47
48
# File 'lib/wakari/models/support/naming.rb', line 41

def model_name
  @_model_name ||= begin
    namespace = self.parents.detect do |n|
      n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
    end
    Name.new(parent_class, self, namespace)
  end
end

#parent_classObject



31
32
33
# File 'lib/wakari/models/support/naming.rb', line 31

def parent_class
  self.name.split("::")[0..-2].join("::").constantize
end