Class: JsFromRoutes::Configuration
- Inherits:
-
Object
- Object
- JsFromRoutes::Configuration
- Defined in:
- lib/js_from_routes/generator.rb
Instance Attribute Summary collapse
-
#all_helpers_file ⇒ Object
Returns the value of attribute all_helpers_file.
-
#client_library ⇒ Object
Returns the value of attribute client_library.
-
#export_if ⇒ Object
Returns the value of attribute export_if.
-
#file_suffix ⇒ Object
Returns the value of attribute file_suffix.
-
#helper_mappings ⇒ Object
Returns the value of attribute helper_mappings.
-
#output_folder ⇒ Object
Returns the value of attribute output_folder.
-
#template_all_path ⇒ Object
Returns the value of attribute template_all_path.
-
#template_index_path ⇒ Object
Returns the value of attribute template_index_path.
-
#template_path ⇒ Object
Returns the value of attribute template_path.
Instance Method Summary collapse
-
#initialize(root) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(root) ⇒ Configuration
Returns a new instance of Configuration.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/js_from_routes/generator.rb', line 143 def initialize(root) dir = %w[frontend packs javascript assets].find { |dir| root.join("app", dir).exist? } @all_helpers_file = true @client_library = "@js-from-routes/client" @export_if = ->(route) { route.defaults.fetch(:export, nil) } @file_suffix = "Api.js" @helper_mappings = {} @output_folder = root.join("app", dir, "api") @template_path = File.("template.js.erb", __dir__) @template_all_path = File.("template_all.js.erb", __dir__) @template_index_path = File.("template_index.js.erb", __dir__) end |
Instance Attribute Details
#all_helpers_file ⇒ Object
Returns the value of attribute all_helpers_file.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def all_helpers_file @all_helpers_file end |
#client_library ⇒ Object
Returns the value of attribute client_library.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def client_library @client_library end |
#export_if ⇒ Object
Returns the value of attribute export_if.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def export_if @export_if end |
#file_suffix ⇒ Object
Returns the value of attribute file_suffix.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def file_suffix @file_suffix end |
#helper_mappings ⇒ Object
Returns the value of attribute helper_mappings.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def helper_mappings @helper_mappings end |
#output_folder ⇒ Object
Returns the value of attribute output_folder.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def output_folder @output_folder end |
#template_all_path ⇒ Object
Returns the value of attribute template_all_path.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def template_all_path @template_all_path end |
#template_index_path ⇒ Object
Returns the value of attribute template_index_path.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def template_index_path @template_index_path end |
#template_path ⇒ Object
Returns the value of attribute template_path.
139 140 141 |
# File 'lib/js_from_routes/generator.rb', line 139 def template_path @template_path end |