Class: JsFromRoutes::AllRoutes
- Inherits:
-
Object
- Object
- JsFromRoutes::AllRoutes
- Defined in:
- lib/js_from_routes/generator.rb
Overview
Internal: Helper class used as a presenter for the all helpers template.
Instance Attribute Summary collapse
-
#helpers ⇒ Object
readonly
Returns the value of attribute helpers.
Instance Method Summary collapse
-
#cache_key ⇒ Object
Public: Used to check whether the file should be generated again, changes based on the configuration, and route definition.
-
#filename ⇒ Object
Internal: Name of the JS file where all helpers will be exported.
-
#initialize(helpers, config) ⇒ AllRoutes
constructor
A new instance of AllRoutes.
Constructor Details
#initialize(helpers, config) ⇒ AllRoutes
Returns a new instance of AllRoutes.
15 16 17 |
# File 'lib/js_from_routes/generator.rb', line 15 def initialize(helpers, config) @helpers, @config = helpers, config end |
Instance Attribute Details
#helpers ⇒ Object (readonly)
Returns the value of attribute helpers.
13 14 15 |
# File 'lib/js_from_routes/generator.rb', line 13 def helpers @helpers end |
Instance Method Details
#cache_key ⇒ Object
Public: Used to check whether the file should be generated again, changes based on the configuration, and route definition.
21 22 23 |
# File 'lib/js_from_routes/generator.rb', line 21 def cache_key helpers.map(&:import_filename).join + File.read(@config.template_all_path) end |
#filename ⇒ Object
Internal: Name of the JS file where all helpers will be exported.
26 27 28 29 30 |
# File 'lib/js_from_routes/generator.rb', line 26 def filename path = @config.all_helpers_file path = "index#{File.extname(@config.file_suffix)}" if path == true @config.output_folder.join(path) end |