Module: NtiReceiptBuilder

Defined in:
lib/nti_receipt_builder.rb,
lib/nti_receipt_builder/engine.rb,
lib/nti_receipt_builder/errors.rb,
lib/nti_receipt_builder/version.rb,
lib/nti_receipt_builder/elements.rb,
lib/nti_receipt_builder/renderer.rb,
lib/nti_receipt_builder/variables.rb,
lib/nti_receipt_builder/set_default.rb,
lib/nti_receipt_builder/configuration.rb,
lib/nti_receipt_builder/render_result.rb,
lib/nti_receipt_builder/template_form.rb,
lib/nti_receipt_builder/type_inference.rb,
app/models/nti_receipt_builder/template.rb,
lib/nti_receipt_builder/layout_validator.rb,
lib/nti_receipt_builder/variable_resolver.rb,
lib/nti_receipt_builder/presenters/element.rb,
lib/nti_receipt_builder/variable_definition.rb,
app/helpers/nti_receipt_builder/render_helper.rb,
lib/nti_receipt_builder/presenters/collection.rb,
lib/generators/nti_receipt_builder/install_generator.rb,
app/controllers/concerns/nti_receipt_builder/templates_controller.rb

Overview

A receipt template builder and renderer.

NtiReceiptBuilder.configure { |config| config.variables_class = OrderReceiptVariables }

The configured Variables subclass supplies the placeholder vocabulary, so the gem itself carries no domain terms. See NtiReceiptBuilder::Variables.

Defined Under Namespace

Modules: Elements, Generators, Presenters, RenderHelper, TemplatesController, TypeInference Classes: Configuration, Engine, Error, InvalidVariablesError, LayoutValidator, NotConfiguredError, RenderResult, Renderer, SetDefault, Template, TemplateForm, VariableDefinition, VariableResolver, Variables

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.configObject



38
39
40
# File 'lib/nti_receipt_builder.rb', line 38

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



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

def configure
  yield(config) if block_given?
  config
end

.reset_config!Object

Resets configuration to defaults. Intended for test suites.



43
44
45
# File 'lib/nti_receipt_builder.rb', line 43

def reset_config!
  @config = Configuration.new
end

.template_classObject



48
# File 'lib/nti_receipt_builder.rb', line 48

def template_class = config.template_class

.variables_classObject



47
# File 'lib/nti_receipt_builder.rb', line 47

def variables_class = config.variables_class