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.4"

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)


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

def self.deep_merge_shared_data?
  Configuration.deep_merge_shared_data
end

.default_render?Boolean

Returns:

  • (Boolean)


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

def self.default_render?
  Configuration.default_render
end

.html_headersObject



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

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

.html_headers=(headers) ⇒ Object



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

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

.layoutObject



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

def self.layout
  Configuration.layout
end

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



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

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

.reset!Object



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

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

.share(**args) ⇒ Object

“Setters”



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

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

.share_block(block) ⇒ Object



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

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

.shared_data(controller) ⇒ Object

“Getters”



15
16
17
18
# 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)


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

def self.ssr_enabled?
  Configuration.ssr_enabled
end

.ssr_urlObject



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

def self.ssr_url
  Configuration.ssr_url
end

.versionObject



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

def self.version
  Configuration.evaluated_version
end