Class: RjsRails::Runtime::Config
- Inherits:
-
Object
- Object
- RjsRails::Runtime::Config
- Defined in:
- lib/rjs-rails/runtime/config.rb
Instance Attribute Summary collapse
-
#build_config ⇒ Object
writeonly
Sets the attribute build_config.
-
#env ⇒ Object
writeonly
Sets the attribute env.
Instance Method Summary collapse
- #helper ⇒ Object
-
#initialize(env = nil) ⇒ Config
constructor
A new instance of Config.
- #module_path(m) ⇒ Object
- #module_paths ⇒ Object
- #paths ⇒ Object
- #static_include ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(env = nil) ⇒ Config
Returns a new instance of Config.
9 10 11 |
# File 'lib/rjs-rails/runtime/config.rb', line 9 def initialize(env = nil) self.env = env end |
Instance Attribute Details
#build_config=(value) ⇒ Object
Sets the attribute build_config
7 8 9 |
# File 'lib/rjs-rails/runtime/config.rb', line 7 def build_config=(value) @build_config = value end |
#env=(value) ⇒ Object
Sets the attribute env
7 8 9 |
# File 'lib/rjs-rails/runtime/config.rb', line 7 def env=(value) @env = value end |
Instance Method Details
#helper ⇒ Object
37 38 39 |
# File 'lib/rjs-rails/runtime/config.rb', line 37 def helper ActionController::Base.helpers end |
#module_path(m) ⇒ Object
32 33 34 |
# File 'lib/rjs-rails/runtime/config.rb', line 32 def module_path(m) helper.javascript_path m end |
#module_paths ⇒ Object
21 22 23 24 25 |
# File 'lib/rjs-rails/runtime/config.rb', line 21 def module_paths mpaths = {} build_config.module_names.map{ |m| mpaths[m] = module_path(m) } return mpaths end |
#paths ⇒ Object
27 28 29 30 |
# File 'lib/rjs-rails/runtime/config.rb', line 27 def paths paths = build_config.paths paths.merge(module_paths) end |
#static_include ⇒ Object
13 14 15 |
# File 'lib/rjs-rails/runtime/config.rb', line 13 def static_include @static_include ||= template end |
#template ⇒ Object
17 18 19 |
# File 'lib/rjs-rails/runtime/config.rb', line 17 def template "<script>var require = #{JSON.generate(config)}</script>" end |