Module: Vandelay::Buildable

Defined in:
lib/vandelay/buildable.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/vandelay/buildable.rb', line 3

def self.included(base)

  # Set default values on the base class so buildables
  #  do not over write each other's defaults.
  base.send :class_variable_set, :@@_internal_hash, {}
  base.define_singleton_method(:__set_default) do |attribute, default|
    self.send(:class_variable_get, :@@_internal_hash)[attribute] = default
  end

  base.send :include, InstanceMethods
  base.extend ClassMethods
end