Module: InertiaRails

Defined in:
lib/inertia_rails.rb,
lib/inertia_rails/lazy.rb,
lib/inertia_rails/rspec.rb,
lib/inertia_rails/engine.rb,
lib/inertia_rails/version.rb,
lib/inertia_rails/renderer.rb,
lib/inertia_rails/controller.rb,
lib/inertia_rails/middleware.rb,
lib/inertia_rails/inertia_rails.rb,
lib/generators/inertia_rails/install_generator.rb,
app/controllers/inertia_rails/static_controller.rb

Defined Under Namespace

Modules: Configuration, Controller, Helper, RSpec Classes: Engine, Error, InstallGenerator, Lazy, Middleware, Renderer, StaticController

Constant Summary collapse

VERSION =
"2.0.0"

Class Method Summary collapse

Class Method Details

.configure {|Configuration| ... } ⇒ Object

Yields:



10
11
12
# File 'lib/inertia_rails/inertia_rails.rb', line 10

def self.configure
  yield(Configuration)
end

.html_headersObject



35
36
37
# File 'lib/inertia_rails/inertia_rails.rb', line 35

def self.html_headers
  self.threadsafe_html_headers || []
end

.html_headers=(headers) ⇒ Object



48
49
50
# File 'lib/inertia_rails/inertia_rails.rb', line 48

def self.html_headers=(headers)
  self.threadsafe_html_headers = headers
end

.layoutObject



23
24
25
# File 'lib/inertia_rails/inertia_rails.rb', line 23

def self.layout
  Configuration.layout
end

.lazy(value = nil, &block) ⇒ Object



58
59
60
# File 'lib/inertia_rails/inertia_rails.rb', line 58

def self.lazy(value = nil, &block)
  InertiaRails::Lazy.new(value, &block)
end

.reset!Object



52
53
54
55
56
# File 'lib/inertia_rails/inertia_rails.rb', line 52

def self.reset!
  self.shared_plain_data = {}
  self.shared_blocks = []
  self.html_headers = []
end

.share(**args) ⇒ Object

“Setters”



40
41
42
# File 'lib/inertia_rails/inertia_rails.rb', line 40

def self.share(**args)
  self.shared_plain_data = self.shared_plain_data.merge(args)
end

.share_block(block) ⇒ Object



44
45
46
# File 'lib/inertia_rails/inertia_rails.rb', line 44

def self.share_block(block)
  self.shared_blocks = self.shared_blocks + [block]
end

.shared_data(controller) ⇒ Object

“Getters”



15
16
17
# File 'lib/inertia_rails/inertia_rails.rb', line 15

def self.shared_data(controller)
  shared_plain_data.merge!(evaluated_blocks(controller, shared_blocks))
end

.ssr_enabled?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/inertia_rails/inertia_rails.rb', line 27

def self.ssr_enabled?
  Configuration.ssr_enabled
end

.ssr_urlObject



31
32
33
# File 'lib/inertia_rails/inertia_rails.rb', line 31

def self.ssr_url
  Configuration.ssr_url
end

.versionObject



19
20
21
# File 'lib/inertia_rails/inertia_rails.rb', line 19

def self.version
  Configuration.evaluated_version
end