Module: Zobi::InstanceMethods

Defined in:
lib/zobi.rb

Instance Method Summary collapse

Instance Method Details

#collectionObject



34
35
36
37
38
39
40
41
42
# File 'lib/zobi.rb', line 34

def collection
  return @collection if @collection
  c = zobi_resource_class
  BEHAVIORS.each do |behavior|
    next unless self.class.behavior_included?(behavior)
    c = send :"#{behavior}_collection", c
  end
  @collection = (c.is_a?(Class) ? c.all : c)
end

#zobi_resource_classObject



29
30
31
32
# File 'lib/zobi.rb', line 29

def zobi_resource_class
  return resource_class if self.class.behavior_included?(:inherited)
  self.class.name.demodulize.gsub('Controller', '').singularize.constantize
end