Module: Preinitializable

Defined in:
lib/mixers/preinitialize.rb

Overview

– class Module

def default_instance_variables(complete=false)
  @default_instance_variables ||= {}
  unless complete
    return @default_instance_variables
  else
    parent = ancestors[1]
    if parent
      return @default_instance_variables.merge(parent.default_instance_variables)
    else
      return @default_instance_variables
    end
  end
end

end ++

Defined Under Namespace

Modules: Meta

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/mixers/preinitialize.rb', line 61

def self.included(base)
  if Class===base
    (class << base; self; end).__send__(:alias_method, :post_new, :new)
    base.extend Meta
  else
    (class << base; self; end).__send__(:define_method, :included, &method(:included))
  end
end