Module: Isomorfeus
- Defined in:
- lib/isomorfeus/top_level.rb,
lib/isomorfeus/react/config.rb,
lib/isomorfeus/top_level_ssr.rb,
lib/isomorfeus/props/validator.rb,
lib/isomorfeus/react_view_helper.rb,
lib/isomorfeus/props/validate_hash_proxy.rb,
lib/isomorfeus/react/redis_component_cache.rb,
lib/isomorfeus/react/memcached_component_cache.rb,
lib/isomorfeus/react/thread_local_component_cache.rb
Defined Under Namespace
Modules: Professional, Props, ReactViewHelper
Classes: ThreadLocalComponentCache, TopLevel
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.component_cache_init_block ⇒ Object
Returns the value of attribute component_cache_init_block.
112
113
114
|
# File 'lib/isomorfeus/react/config.rb', line 112
def component_cache_init_block
@component_cache_init_block
end
|
.current_user_sid ⇒ Object
Returns the value of attribute current_user_sid.
4
5
6
|
# File 'lib/isomorfeus/react/config.rb', line 4
def current_user_sid
@current_user_sid
end
|
Returns the value of attribute env.
9
10
11
|
# File 'lib/isomorfeus/react/config.rb', line 9
def env
@env
end
|
.initial_state_fetched ⇒ Object
Returns the value of attribute initial_state_fetched.
5
6
7
|
# File 'lib/isomorfeus/react/config.rb', line 5
def initial_state_fetched
@initial_state_fetched
end
|
.initialized ⇒ Object
Returns the value of attribute initialized.
8
9
10
|
# File 'lib/isomorfeus/react/config.rb', line 8
def initialized
@initialized
end
|
.server_side_rendering ⇒ Object
Returns the value of attribute server_side_rendering.
113
114
115
|
# File 'lib/isomorfeus/react/config.rb', line 113
def server_side_rendering
@server_side_rendering
end
|
.ssr_hot_asset_url ⇒ Object
Returns the value of attribute ssr_hot_asset_url.
114
115
116
|
# File 'lib/isomorfeus/react/config.rb', line 114
def ssr_hot_asset_url
@ssr_hot_asset_url
end
|
.ssr_response_status ⇒ Object
Returns the value of attribute ssr_response_status.
7
8
9
|
# File 'lib/isomorfeus/react/config.rb', line 7
def ssr_response_status
@ssr_response_status
end
|
.top_component ⇒ Object
Returns the value of attribute top_component.
6
7
8
|
# File 'lib/isomorfeus/react/config.rb', line 6
def top_component
@top_component
end
|
Returns the value of attribute zeitwerk.
10
11
12
|
# File 'lib/isomorfeus/react/config.rb', line 10
def zeitwerk
@zeitwerk
end
|
.zeitwerk_lock ⇒ Object
Returns the value of attribute zeitwerk_lock.
117
118
119
|
# File 'lib/isomorfeus/react/config.rb', line 117
def zeitwerk_lock
@zeitwerk_lock
end
|
Class Method Details
.add_client_init_after_store_class_name(init_class_name) ⇒ Object
32
33
34
|
# File 'lib/isomorfeus/react/config.rb', line 32
def add_client_init_after_store_class_name(init_class_name)
client_init_after_store_class_names << init_class_name
end
|
.add_client_init_class_name(init_class_name) ⇒ Object
28
29
30
|
# File 'lib/isomorfeus/react/config.rb', line 28
def add_client_init_class_name(init_class_name)
client_init_class_names << init_class_name
end
|
.add_client_option(key, value = nil) ⇒ Object
36
37
38
39
|
# File 'lib/isomorfeus/react/config.rb', line 36
def add_client_option(key, value = nil)
self.class.attr_accessor(key)
self.send("#{key}=", value)
end
|
.cached_component_class(class_name) ⇒ Object
47
48
49
50
|
# File 'lib/isomorfeus/react/config.rb', line 47
def cached_component_class(class_name)
return cached_component_classes[class_name] if cached_component_classes.key?(class_name)
cached_component_classes[class_name] = "::#{class_name}".constantize
end
|
.cached_component_classes ⇒ Object
42
43
44
|
# File 'lib/isomorfeus/react/config.rb', line 42
def cached_component_classes
@cached_component_classes ||= {}
end
|
.component_cache_init(&block) ⇒ Object
119
120
121
|
# File 'lib/isomorfeus/react/config.rb', line 119
def component_cache_init(&block)
@component_cache_init_block = block
end
|
.configuration(&block) ⇒ Object
123
124
125
|
# File 'lib/isomorfeus/react/config.rb', line 123
def configuration(&block)
block.call(self)
end
|
.development? ⇒ Boolean
71
72
73
|
# File 'lib/isomorfeus/react/config.rb', line 71
def development?
@development
end
|
.execute_init_after_store_classes ⇒ Object
58
59
60
61
62
|
# File 'lib/isomorfeus/react/config.rb', line 58
def execute_init_after_store_classes
client_init_after_store_class_names.each do |constant|
constant.constantize.send(:init)
end
end
|
.execute_init_classes ⇒ Object
52
53
54
55
56
|
# File 'lib/isomorfeus/react/config.rb', line 52
def execute_init_classes
client_init_class_names.each do |constant|
constant.constantize.send(:init)
end
end
|
12
13
14
15
16
17
|
# File 'lib/isomorfeus/react/config.rb', line 12
def init
return if initialized
@initialized = true
Isomorfeus.init_store
execute_init_classes
end
|
.load_configuration(directory) ⇒ Object
154
155
156
157
158
|
# File 'lib/isomorfeus/react/config.rb', line 154
def load_configuration(directory)
Dir.glob(File.join(directory, '*.rb')).sort.each do |file|
require File.expand_path(file)
end
end
|
.production? ⇒ Boolean
75
76
77
|
# File 'lib/isomorfeus/react/config.rb', line 75
def production?
@production
end
|
.raise_error(error_class: nil, message: nil, stack: nil) ⇒ Object
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
# File 'lib/isomorfeus/react/config.rb', line 163
def raise_error(error_class: nil, message: nil, stack: nil)
error_class = RuntimeError unless error_class
execution_environment = if on_browser? then 'on Browser'
elsif on_ssr? then 'in Server Side Rendering'
elsif on_server? then 'on Server'
elsif on_mobile? then 'on Mobile'
elsif on_database? then 'on Database'
else
'on Client'
end
error = error_class.new("Isomorfeus in #{env} #{execution_environment}:\n#{message}")
error.set_backtrace(stack) if stack
if Isomorfeus.development?
if RUBY_ENGINE == 'opal'
ecn = error_class ? error_class.name : ''
m = message ? message : ''
s = stack ? stack : ''
`console.error(ecn, m, s)`
else
STDERR.puts "#{ecn}: #{m}\n #{s}"
end
end
raise error
end
|
.ssr_contexts ⇒ Object
146
147
148
|
# File 'lib/isomorfeus/react/config.rb', line 146
def ssr_contexts
@ssr_contexts ||= {}
end
|
.test? ⇒ Boolean
79
80
81
|
# File 'lib/isomorfeus/react/config.rb', line 79
def test?
@test
end
|
150
151
152
|
# File 'lib/isomorfeus/react/config.rb', line 150
def version
Isomorfeus::VERSION
end
|