Module: Ajax
- Includes:
- Helpers
- Defined in:
- lib/ajax.rb,
lib/ajax/routes.rb,
lib/ajax/helpers.rb,
lib/ajax/railtie.rb,
lib/ajax/action_view.rb,
lib/ajax/application.rb,
lib/ajax/rspec/helpers.rb,
lib/ajax/rspec/extension.rb,
lib/ajax/action_controller.rb,
lib/ajax/helpers/url_helper.rb,
lib/ajax/helpers/task_helper.rb,
lib/ajax/helpers/robot_helper.rb,
lib/ajax/helpers/request_helper.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ActionController, ActionView, Helpers, RSpec, Routes Classes: Application, Railtie
Class Attribute Summary collapse
-
.app ⇒ Object
Returns the value of attribute app.
-
.framework_path ⇒ Object
Return the path to the framework page.
-
.logger ⇒ Object
Return a logger instance.
Class Method Summary collapse
-
.enabled=(value) ⇒ Object
Set to false to disable this plugin completely.
-
.is_enabled? ⇒ Boolean
(also: enabled?)
Return a boolean indicating whether the plugin is enabled.
-
.is_mocked? ⇒ Boolean
Return a boolean indicating whether the plugin is being mock tested.
-
.lazy_load_assets=(value) ⇒ Object
Set to false to disable lazy loading assets.
-
.lazy_load_assets? ⇒ Boolean
Return a boolean indicating whether to enable lazy loading assets.
-
.mocked=(value) ⇒ Object
Set to true to enable mocking testing the plugin.
-
.root ⇒ Object
Return the full path to the root of the Ajax plugin/gem directory.
- .version ⇒ Object
Methods included from Helpers
Class Attribute Details
.app ⇒ Object
Returns the value of attribute app.
12 13 14 |
# File 'lib/ajax.rb', line 12 def app @app end |
.framework_path ⇒ Object
Return the path to the framework page.
Default: /ajax/framework
55 56 57 |
# File 'lib/ajax.rb', line 55 def self.framework_path @framework_path ||= '/ajax/framework' end |
.logger ⇒ Object
Return a logger instance.
Use the Rails logger by default, assign nil to turn off logging. Dummy a logger if logging is turned off of if Ajax isn’t enabled.
25 26 27 28 29 30 31 |
# File 'lib/ajax.rb', line 25 def self.logger if !@logger.nil? && is_enabled? @logger else @logger = Class.new { def method_missing(*args); end; }.new end end |
Class Method Details
.enabled=(value) ⇒ Object
Set to false to disable this plugin completely.
ActionController and ActionView helpers are still mixed in but they are effectively disabled, which means your code will still run.
48 49 50 |
# File 'lib/ajax.rb', line 48 def self.enabled=(value) @enabled = !!value end |
.is_enabled? ⇒ Boolean Also known as: enabled?
Return a boolean indicating whether the plugin is enabled.
Enabled by default.
36 37 38 |
# File 'lib/ajax.rb', line 36 def self.is_enabled? @enabled.nil? ? true : !!@enabled end |
.is_mocked? ⇒ Boolean
Return a boolean indicating whether the plugin is being mock tested.
Mocking forces the environment to be returned after Ajax processing so that we can introspect it and verify that the correct actions were taken.
82 83 84 |
# File 'lib/ajax.rb', line 82 def self.is_mocked? @mocked ||= false end |
.lazy_load_assets=(value) ⇒ Object
Set to false to disable lazy loading assets. Callbacks will be executed immediately.
ActionController and ActionView helpers are still mixed in but they are effectively disabled, which means your code will still run.
73 74 75 |
# File 'lib/ajax.rb', line 73 def self.lazy_load_assets=(value) @lazy_load_assets = !!value end |
.lazy_load_assets? ⇒ Boolean
Return a boolean indicating whether to enable lazy loading assets. There are currently issues with some browsers when using this feature.
Disabled by default.
63 64 65 |
# File 'lib/ajax.rb', line 63 def self.lazy_load_assets? @lazy_load_assets.nil? ? false : !!@lazy_load_assets end |
.mocked=(value) ⇒ Object
Set to true to enable mocking testing the plugin.
Integration tests will return the result of the URL rewriting in a special response. Redirects will be indicated using standard responses.
Use this to test the handling of URLs in various states and with different HTTP request methods.
93 94 95 |
# File 'lib/ajax.rb', line 93 def self.mocked=(value) @mocked = !!value end |
.root ⇒ Object
Return the full path to the root of the Ajax plugin/gem directory.
17 18 19 |
# File 'lib/ajax.rb', line 17 def self.root @root ||= Pathname.new(File.('../../', __FILE__)) end |
.version ⇒ Object
97 98 99 |
# File 'lib/ajax.rb', line 97 def self.version @version ||= File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip end |