Module: Property::Declaration::Base

Defined in:
lib/property/declaration.rb

Overview

This is just a helper module that includes the necessary code for property definition, but without the validation/save hooks.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/property/declaration.rb', line 17

def self.included(base)
  base.class_eval do
    extend  ClassMethods
    include InstanceMethods

    class << self
      # Every class has it's own schema.
      attr_accessor :schema

      def schema
        @schema ||= make_schema
      end

      private
        # Build schema and manage inheritance.
        def make_schema
          Property::Schema.new(self.to_s, :class => self)
        end
    end
  end
end