Module: Mjs

Defined in:
lib/mjs.rb,
lib/mjs/utils.rb,
lib/mjs/helper.rb,
lib/mjs/page_object.rb,
lib/mjs/java_script_context.rb

Overview

This file is almost derived from prototype_helper.rb of RoR

Defined Under Namespace

Modules: Helper, PageObject, Utils Classes: Application, JavaScriptContext, JavaScriptElementProxy, JavaScriptProxy, JavaScriptVariableProxy, Main

Class Method Summary collapse

Class Method Details

.activateObject

Activation hook - runs after AfterAppLoads BootLoader



40
41
# File 'lib/mjs.rb', line 40

def self.activate
end

.deactivateObject

Deactivation hook - triggered by Merb::Slices.deactivate(Mjs)



44
45
# File 'lib/mjs.rb', line 44

def self.deactivate
end

.initObject

Initialization hook - runs before AfterAppLoads BootLoader



35
36
37
# File 'lib/mjs.rb', line 35

def self.init
  Merb::Controller.send(:include, ::Mjs::Helper)
end

.loadedObject

Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.



30
31
32
# File 'lib/mjs.rb', line 30

def self.loaded
  require 'mjs/helper'
end

.setup_router(scope) ⇒ Object

Note:

prefix your named routes with :mjs_ to avoid potential conflicts with global named routes.

Setup routes inside the host application

Parameters:

  • scope (Merb::Router::Behaviour)

    Routes will be added within this scope (namespace). In fact, any router behaviour is a valid namespace, so you can attach routes at any level of your router setup.



56
57
58
59
60
61
62
63
# File 'lib/mjs.rb', line 56

def self.setup_router(scope)
  # example of a named route
  scope.match('/index(.:format)').to(:controller => 'main', :action => 'index').name(:index)
  # the slice is mounted at /mjs - note that it comes before default_routes
  scope.match('/').to(:controller => 'main', :action => 'index').name(:home)
  # enable slice-level default routes by default
  scope.default_routes
end