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 =
"3.1.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

.deep_merge_shared_data?Boolean

Returns:

  • (Boolean)


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

def self.deep_merge_shared_data?
  Configuration.deep_merge_shared_data
end

.default_render?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/inertia_rails/inertia_rails.rb', line 37

def self.default_render?
  Configuration.default_render
end

.html_headersObject



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

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

.html_headers=(headers) ⇒ Object



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

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

.layoutObject



25
26
27
# File 'lib/inertia_rails/inertia_rails.rb', line 25

def self.layout
  Configuration.layout
end

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



68
69
70
# File 'lib/inertia_rails/inertia_rails.rb', line 68

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

.reset!Object



62
63
64
65
66
# File 'lib/inertia_rails/inertia_rails.rb', line 62

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

.share(**args) ⇒ Object

“Setters”



50
51
52
# File 'lib/inertia_rails/inertia_rails.rb', line 50

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

.share_block(block) ⇒ Object



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

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

.shared_data(controller) ⇒ Object

“Getters”



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

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

.ssr_enabled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/inertia_rails/inertia_rails.rb', line 29

def self.ssr_enabled?
  Configuration.ssr_enabled
end

.ssr_urlObject



33
34
35
# File 'lib/inertia_rails/inertia_rails.rb', line 33

def self.ssr_url
  Configuration.ssr_url
end

.versionObject



21
22
23
# File 'lib/inertia_rails/inertia_rails.rb', line 21

def self.version
  Configuration.evaluated_version
end