Module: Halogen::Resource

Defined in:
lib/halogen/resource.rb

Overview

Behavior for representers with a single primary resource

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:


7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/halogen/resource.rb', line 7

def self.included(base) # :nodoc:
  if base.included_modules.include?(Collection)
    fail InvalidResource, "#{base.name} has already defined a collection"
  end

  base.extend ClassMethods

  base.send :include, InstanceMethods

  base.send :attr_reader, :resource

  base.class.send :attr_accessor, :resource_name
end