Module: Rhales

Defined in:
lib/rhales.rb,
lib/rhales/csp.rb,
lib/rhales/tilt.rb,
lib/rhales/view.rb,
lib/rhales/errors.rb,
lib/rhales/context.rb,
lib/rhales/version.rb,
lib/rhales/hydrator.rb,
lib/rhales/rue_document.rb,
lib/rhales/configuration.rb,
lib/rhales/template_engine.rb,
lib/rhales/view_composition.rb,
lib/rhales/adapters/base_auth.rb,
lib/rhales/hydration_endpoint.rb,
lib/rhales/hydration_injector.rb,
lib/rhales/hydration_registry.rb,
lib/rhales/mount_point_detector.rb,
lib/rhales/adapters/base_request.rb,
lib/rhales/adapters/base_session.rb,
lib/rhales/safe_injection_validator.rb,
lib/rhales/hydration_data_aggregator.rb,
lib/rhales/parsers/handlebars_parser.rb,
lib/rhales/parsers/rue_format_parser.rb,
lib/rhales/earliest_injection_detector.rb,
lib/rhales/link_based_injection_detector.rb,
lib/rhales/refinements/require_refinements.rb,
lib/rhales/errors/hydration_collision_error.rb

Overview

lib/rhales/errors/hydration_collision_error.rb

Defined Under Namespace

Modules: Adapters, Ruequire Classes: CSP, Configuration, ConfigurationError, Context, EarliestInjectionDetector, Error, HandlebarsParser, HydrationCollisionError, HydrationConfiguration, HydrationDataAggregator, HydrationEndpoint, HydrationInjector, HydrationRegistry, Hydrator, JsonAwareContext, LinkBasedInjectionDetector, MountPointDetector, ParseError, RenderError, RueDocument, RueFormatParser, SafeInjectionValidator, TemplateEngine, TemplateError, TiltTemplate, ValidationError, View, ViewComposition

Constant Summary collapse

VERSION =
'0.4.0'

Class Method Summary collapse

Class Method Details

.configObject

Shorthand access to configuration



265
266
267
# File 'lib/rhales/configuration.rb', line 265

def config
  configuration
end

.configurationObject

Global configuration instance



247
248
249
# File 'lib/rhales/configuration.rb', line 247

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Configure Rhales with block

Yields:



252
253
254
255
256
257
# File 'lib/rhales/configuration.rb', line 252

def configure
  yield(configuration) if block_given?
  configuration.validate!
  configuration.freeze!
  configuration
end

.create_context(request: nil, session: nil, user: nil, locale: nil, **props) ⇒ Object

Create context with props (for advanced usage)



65
66
67
# File 'lib/rhales.rb', line 65

def self.create_context(request: nil, session: nil, user: nil, locale: nil, **props)
  Context.for_view(request, session, user, locale, **props)
end

.render(template_name, request: nil, session: nil, user: nil, locale: nil, **props) ⇒ Object

Convenience method to create a view with props



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

def self.render(template_name, request: nil, session: nil, user: nil, locale: nil, **props)
  view = View.new(request, session, user, locale, props: props)
  view.render(template_name)
end

.render_template(template_content, context_data = {}) ⇒ Object

Quick template rendering for testing/simple use cases



59
60
61
62
# File 'lib/rhales.rb', line 59

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)



260
261
262
# File 'lib/rhales/configuration.rb', line 260

def reset_configuration!
  @configuration = nil
end