Module: UniRails
- Defined in:
- lib/uni_rails.rb,
lib/uni_rails/app.rb,
lib/uni_rails/app/css.rb,
lib/uni_rails/helpers.rb,
lib/uni_rails/version.rb,
lib/uni_rails/app/views.rb,
lib/uni_rails/app/javascript.rb,
lib/uni_rails/helpers/css_helper.rb,
lib/uni_rails/helpers/javascript_helper.rb
Defined Under Namespace
Modules: Helpers
Classes: App, Error
Constant Summary
collapse
- VERSION =
"0.4.0"
Class Method Summary
collapse
Class Method Details
.css(content) ⇒ Object
76
77
78
|
# File 'lib/uni_rails.rb', line 76
def self.css(content)
UniRails::App::CSS.css = content
end
|
.enable_turbo_rails! ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/uni_rails.rb', line 24
def self.enable_turbo_rails!
require "turbo-rails"
App.configure do
initializer "turbo.no_action_cable", before: :set_eager_load_paths do
unless defined?(ActionCable)
Rails.autoloaders.once.do_not_eager_load("#{Turbo::Engine.root}/app/channels")
end
unless defined?(ActiveJob)
Rails.autoloaders.once.do_not_eager_load("#{Turbo::Engine.root}/app/jobs")
end
end
end
App::Javascript.dependencies.merge!(
"turbo" => "https://unpkg.com/@hotwired/[email protected]/dist/turbo.es2017-umd.js"
)
end
|
.import_maps(dependencies) ⇒ Object
.javascript(content) ⇒ Object
.rackup_handler ⇒ Object
49
50
51
52
53
54
|
# File 'lib/uni_rails.rb', line 49
def self.rackup_handler
@@rackup_handler ||= begin
require 'rackup'
Rackup::Handler::WEBrick
end
end
|
.rackup_handler=(handler) ⇒ Object
45
46
47
|
# File 'lib/uni_rails.rb', line 45
def self.rackup_handler=(handler)
@@rackup_handler = handler
end
|
.register_view(action, view) ⇒ Object
56
57
58
|
# File 'lib/uni_rails.rb', line 56
def self.register_view(action, view)
UniRails::App::Views.instance.views[action] = view
end
|
.run(**webrick_options) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/uni_rails.rb', line 60
def self.run(**webrick_options)
App.initialize!
rackup_handler.run App, **webrick_options
end
|