Module: JsRoutes
- Defined in:
- lib/js_routes.rb,
lib/js_routes/route.rb,
lib/js_routes/engine.rb,
lib/js_routes/version.rb,
lib/js_routes/instance.rb,
lib/js_routes/middleware.rb,
lib/js_routes/configuration.rb
Defined Under Namespace
Modules: Generators
Classes: Configuration, Engine, Instance, Middleware, Route, SprocketsExtension
Constant Summary
collapse
- VERSION =
"2.2.8"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
20
21
22
|
# File 'lib/js_routes.rb', line 20
def configuration
@configuration ||= Configuration.new
end
|
.definitions(**opts) ⇒ Object
32
33
34
|
# File 'lib/js_routes.rb', line 32
def definitions(**opts)
generate(module_type: 'DTS', **opts)
end
|
.definitions!(file_name = nil, **opts) ⇒ Object
36
37
38
39
|
# File 'lib/js_routes.rb', line 36
def definitions!(file_name = nil, **opts)
file_name ||= configuration.file&.sub(%r{(\.d)?\.(j|t)s\Z}, ".d.ts")
generate!(file_name, module_type: 'DTS', **opts)
end
|
.generate(**opts) ⇒ Object
24
25
26
|
# File 'lib/js_routes.rb', line 24
def generate(**opts)
Instance.new(opts).generate
end
|
.generate!(file_name = configuration.file, **opts) ⇒ Object
28
29
30
|
# File 'lib/js_routes.rb', line 28
def generate!(file_name = configuration.file, **opts)
Instance.new(file: file_name, **opts).generate!
end
|
.json(string) ⇒ Object
41
42
43
|
# File 'lib/js_routes.rb', line 41
def json(string)
ActiveSupport::JSON.encode(string)
end
|
.setup(&block) ⇒ Object
16
17
18
|
# File 'lib/js_routes.rb', line 16
def setup(&block)
configuration.assign(&block)
end
|