Module: Rhales
- Extended by:
- Utils
- Defined in:
- lib/rhales.rb,
lib/rhales/utils.rb,
lib/rhales/errors.rb,
lib/rhales/version.rb,
lib/rhales/core/view.rb,
lib/rhales/core/context.rb,
lib/rhales/security/csp.rb,
lib/rhales/configuration.rb,
lib/rhales/core/rue_document.rb,
lib/rhales/integrations/tilt.rb,
lib/rhales/adapters/base_auth.rb,
lib/rhales/hydration/hydrator.rb,
lib/rhales/core/template_engine.rb,
lib/rhales/adapters/base_request.rb,
lib/rhales/adapters/base_session.rb,
lib/rhales/core/view_composition.rb,
lib/rhales/utils/json_serializer.rb,
lib/rhales/utils/logging_helpers.rb,
lib/rhales/utils/schema_extractor.rb,
lib/rhales/utils/schema_generator.rb,
lib/rhales/middleware/json_responder.rb,
lib/rhales/parsers/handlebars_parser.rb,
lib/rhales/parsers/rue_format_parser.rb,
lib/rhales/middleware/schema_validator.rb,
lib/rhales/hydration/hydration_endpoint.rb,
lib/rhales/hydration/hydration_injector.rb,
lib/rhales/hydration/hydration_registry.rb,
lib/rhales/hydration/mount_point_detector.rb,
lib/rhales/errors/hydration_collision_error.rb,
lib/rhales/hydration/safe_injection_validator.rb,
lib/rhales/hydration/hydration_data_aggregator.rb,
lib/rhales/hydration/earliest_injection_detector.rb,
lib/rhales/hydration/link_based_injection_detector.rb,
lib/rhales/integrations/refinements/require_refinements.rb
Overview
lib/rhales/errors/hydration_collision_error.rb
frozen_string_literal: true
Defined Under Namespace
Modules: Adapters, JSONSerializer, Middleware, Ruequire, Utils Classes: CSP, Configuration, ConfigurationError, Context, EarliestInjectionDetector, Error, HandlebarsParser, HydrationCollisionError, HydrationConfiguration, HydrationDataAggregator, HydrationEndpoint, HydrationInjector, HydrationRegistry, Hydrator, LinkBasedInjectionDetector, MountPointDetector, ParseError, RenderError, RueDocument, RueFormatParser, SafeInjectionValidator, SchemaExtractor, SchemaGenerator, TemplateEngine, TemplateError, TiltTemplate, ValidationError, View, ViewComposition
Constant Summary collapse
- VERSION =
'0.5.3'
Class Attribute Summary collapse
Class Method Summary collapse
-
.config ⇒ Object
Shorthand access to configuration.
-
.configuration ⇒ Object
Global configuration instance.
-
.configure {|configuration| ... } ⇒ Object
Configure Rhales with block.
-
.create_context(request: nil, locale: nil, **props) ⇒ Object
Create context with props (for advanced usage).
-
.render(template_name, request: nil, locale: nil, **props) ⇒ Object
Convenience method to create a view with props.
-
.render_template(template_content, context_data = {}) ⇒ Object
Quick template rendering for testing/simple use cases.
-
.reset_configuration! ⇒ Object
Reset configuration (useful for testing).
Methods included from Utils
Class Attribute Details
.logger ⇒ Object
64 65 66 |
# File 'lib/rhales.rb', line 64 def logger @logger ||= Logger.new($stdout) end |
Class Method Details
.config ⇒ Object
Shorthand access to configuration
312 313 314 |
# File 'lib/rhales/configuration.rb', line 312 def config configuration end |
.configuration ⇒ Object
Global configuration instance
280 281 282 |
# File 'lib/rhales/configuration.rb', line 280 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
Configure Rhales with block
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/rhales/configuration.rb', line 285 def configure yield(configuration) if block_given? configuration.validate! configuration.freeze! # Debug log the configuration (guard against stale test mocks) if Rhales.logger require_relative 'utils/logging_helpers' extend Rhales::Utils::LoggingHelpers (Rhales.logger, :debug, 'Rhales configured', hydration_mismatch_format: configuration.hydration_mismatch_format, hydration_authority: configuration., enable_schema_validation: configuration.enable_schema_validation, fail_on_validation_error: configuration.fail_on_validation_error ) end configuration end |
.create_context(request: nil, locale: nil, **props) ⇒ Object
Create context with props (for advanced usage)
82 83 84 |
# File 'lib/rhales.rb', line 82 def self.create_context(request: nil, locale: nil, **props) Context.for_view(request, locale, **props) end |
.render(template_name, request: nil, locale: nil, **props) ⇒ Object
Convenience method to create a view with props
70 71 72 73 |
# File 'lib/rhales.rb', line 70 def self.render(template_name, request: nil, locale: nil, **props) view = View.new(request, locale, props: props) view.render(template_name) end |
.render_template(template_content, context_data = {}) ⇒ Object
Quick template rendering for testing/simple use cases
76 77 78 79 |
# File 'lib/rhales.rb', line 76 def self.render_template(template_content, context_data = {}) context = Context.minimal(props: context_data) TemplateEngine.render(template_content, context) end |
.reset_configuration! ⇒ Object
Reset configuration (useful for testing)
307 308 309 |
# File 'lib/rhales/configuration.rb', line 307 def reset_configuration! @configuration = nil end |