Module: Mentawai::Core

Defined in:
lib/mentawai/core/input.rb,
lib/mentawai/core/action.rb,
lib/mentawai/core/output.rb,
lib/mentawai/core/cookies.rb,
lib/mentawai/core/forward.rb,
lib/mentawai/core/session.rb,
lib/mentawai/core/controller.rb,
lib/mentawai/core/app_context.rb,
lib/mentawai/core/app_manager.rb,
lib/mentawai/core/action_config.rb,
lib/mentawai/core/invocation_chain.rb

Defined Under Namespace

Classes: Action, ActionConfig, AppContext, ApplicationManager, Controller, Cookies, Forward, Input, InvocationChain, Output, Session

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object (private)



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/mentawai/core/controller.rb', line 222

def method_missing(id, *args)

  # Crazy bug: method_missing is being called for everything

  # and not just for controller. Make a crazy call inside

  # an action an you will see;

  #

  # Ex:

  #       class MyAction < Mentawai::Core::Action

  #         def execute

  #           a = {}

  #           a.blow

  #         end

  #       end

  #

  #       The action above will trigger method_missing from

  #       the controller! Now you tell me why!!!

  if not self.is_a?(Controller)
    # This method missing is from the Controller only!

    # I don't want actions triggering this guys!

    # You tell me why this is happening since I have already

    # tried everything to understand this...

    super
  end
  
  # First look custom page methods

  if args.length <= 1 && @appManager.customPageMethods.key?(id) then
    
    className = @appManager.customPageMethods[id][0]
    methodName = @appManager.customPageMethods[id][1]
    exec_page_method(className, methodName, args)
    
    # Then look menta page methods

  elsif args.length <= 1 && @appManager.pageMethods.key?(id) then
  
    className = @appManager.pageMethods[id][0]
    methodName = @appManager.pageMethods[id][1]
    exec_page_method(className, methodName, args)
    
  else
    super
  end
end

Instance Method Details

#fwd(page) ⇒ Object

Methods to create consequences…



121
122
123
# File 'lib/mentawai/core/app_manager.rb', line 121

def fwd(page)
  Forward.new(app.contextPathDir, page)
end