Module: Babl
- Defined in:
- lib/babl.rb,
lib/babl/errors.rb,
lib/babl/railtie.rb,
lib/babl/version.rb,
lib/babl/template.rb,
lib/babl/nodes/dep.rb,
lib/babl/nodes/nav.rb,
lib/babl/utils/ref.rb,
lib/babl/nodes/each.rb,
lib/babl/nodes/with.rb,
lib/babl/utils/hash.rb,
lib/babl/utils/proc.rb,
lib/babl/nodes/merge.rb,
lib/babl/nodes/typed.rb,
lib/babl/utils/array.rb,
lib/babl/utils/value.rb,
lib/babl/nodes/concat.rb,
lib/babl/nodes/object.rb,
lib/babl/nodes/parent.rb,
lib/babl/nodes/switch.rb,
lib/babl/schema/typed.rb,
lib/babl/nodes/is_null.rb,
lib/babl/operators/dep.rb,
lib/babl/operators/nav.rb,
lib/babl/operators/pin.rb,
lib/babl/schema/any_of.rb,
lib/babl/schema/object.rb,
lib/babl/nodes/constant.rb,
lib/babl/nodes/goto_pin.rb,
lib/babl/operators/call.rb,
lib/babl/operators/each.rb,
lib/babl/operators/null.rb,
lib/babl/operators/with.rb,
lib/babl/operators/array.rb,
lib/babl/operators/enter.rb,
lib/babl/operators/merge.rb,
lib/babl/operators/typed.rb,
lib/babl/operators/using.rb,
lib/babl/schema/anything.rb,
lib/babl/utils/dsl_proxy.rb,
lib/babl/nodes/create_pin.rb,
lib/babl/operators/concat.rb,
lib/babl/operators/object.rb,
lib/babl/operators/parent.rb,
lib/babl/operators/source.rb,
lib/babl/operators/static.rb,
lib/babl/operators/switch.rb,
lib/babl/schema/dyn_array.rb,
lib/babl/schema/primitive.rb,
lib/babl/nodes/fixed_array.rb,
lib/babl/operators/default.rb,
lib/babl/operators/extends.rb,
lib/babl/operators/is_null.rb,
lib/babl/operators/partial.rb,
lib/babl/rendering/context.rb,
lib/babl/operators/continue.rb,
lib/babl/operators/nullable.rb,
lib/babl/schema/fixed_array.rb,
lib/babl/nodes/internal_value.rb,
lib/babl/nodes/terminal_value.rb,
lib/babl/builder/chain_builder.rb,
lib/babl/builder/template_base.rb,
lib/babl/rendering/noop_preloader.rb,
lib/babl/rendering/compiled_template.rb
Defined Under Namespace
Modules: ActionView, Builder, Errors, Nodes, Operators, Rendering, Schema, Utils
Classes: AbsoluteLookupContext, Config, Railtie, Template
Constant Summary
collapse
- VERSION =
'0.5.9'
Class Method Summary
collapse
Class Method Details
.compile(*args, &block) ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/babl.rb', line 61
def compile(*args, &block)
raise ArgumentError, 'Wrong number of arguments' if args.size > 1
raise ArgumentError, 'Template or block expected' unless args.empty? ^ block.nil?
(args.empty? ? source(&block) : template.call(args.first)).compile(
pretty: config.pretty,
preloader: config.preloader,
lookup_context: config.lookup_context
)
end
|
.config ⇒ Object
93
94
95
|
# File 'lib/babl.rb', line 93
def config
@config ||= Config.new
end
|
89
90
91
|
# File 'lib/babl.rb', line 89
def configure
yield(config)
end
|
.source(*args, &block) ⇒ Object
72
73
74
|
# File 'lib/babl.rb', line 72
def source(*args, &block)
template.source(*args, &block)
end
|
.template ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/babl.rb', line 76
def template
cached = @cached_template
return cached.last if cached && [config.using].flatten == cached.first
modules = [config.using].flatten.dup
template = Template.new.using(*modules)
@cached_template = [modules, template]
template
end
|