module JsRoutes
typed: strict
typed: strict
Constants
- VERSION
Public Class Methods
configuration()
click to toggle source
# File lib/js_routes.rb, line 28 def configuration @configuration ||= T.let(Configuration.new, T.nilable(JsRoutes::Configuration)) end
definitions(**opts)
click to toggle source
# File lib/js_routes.rb, line 49 def definitions(**opts) generate(**opts, module_type: 'DTS') end
definitions!(file_name = nil, **opts)
click to toggle source
# File lib/js_routes.rb, line 54 def definitions!(file_name = nil, **opts) file_name ||= configuration.file file_name = file_name&.sub(%r{(\.d)?\.(j|t)s\Z}, ".d.ts") generate!(file_name, **opts, module_type: 'DTS') end
generate(**opts)
click to toggle source
# File lib/js_routes.rb, line 33 def generate(**opts) Instance.new(**opts).generate end
generate!(file_name = configuration.file, typed: false, **opts)
click to toggle source
# File lib/js_routes.rb, line 38 def generate!(file_name = configuration.file, typed: false, **opts) Instance.new(file: file_name, **opts).generate! definitions!(file_name, **opts) if typed end
json(value)
click to toggle source
# File lib/js_routes.rb, line 62 def json(value) ActiveSupport::JSON.encode(value) end
remove!(file_name = configuration.file, **opts)
click to toggle source
# File lib/js_routes.rb, line 44 def remove!(file_name = configuration.file, **opts) Instance.new(file: file_name, **opts).remove! end
setup(&block)
click to toggle source
# File lib/js_routes.rb, line 23 def setup(&block) configuration.setup(&block) end