Module: CampExt

Defined in:
lib/camping_ext.rb

Overview

This module is included if you use camping. Thid module and file is requires to make Equipment work with Camping.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(app) ⇒ Object

Equips global equipments. Make sure they are included before loading your apps.



61
62
63
# File 'lib/camping_ext.rb', line 61

def self.extended(app)
  ::Equipment.global_extensions.each{ |ext| ext.equip(app) }
end

Instance Method Details

#createObject

This will allow you to chain create methods. It also restores the the missing modules.

Explanation

When calling YourApp.create, the call order is :

* YourApp.create
* Last extended module.create
* Second last extended module.create
* ...
* First extended module.create

By extending this app first, it will set a blank create method that will ensure that you don’t get a NoMethodError when calling ‘super`



47
48
49
50
51
52
53
54
55
# File 'lib/camping_ext.rb', line 47

def create
  puts "INFO: CampExt#create called" if $DBG
  unless self::Base.ancestors.include? self::Helpers
    self::Base.send  :include, self::Helpers
    self::Views.send :include, self::Controllers, self::Helpers
    self::Mab.send   :include, self::Views
  end
  super
end

#destroyObject

Not used



58
# File 'lib/camping_ext.rb', line 58

def destroy; false end