Class: Valise::Strategies::Serialization::Tilt
Class Method Summary
collapse
Instance Method Summary
collapse
[], check!, classes, default, instance, instances, register, root_class, set_default
Constructor Details
#initialize(options) ⇒ Tilt
Returns a new instance of Tilt.
11
12
13
14
15
|
# File 'lib/valise/adapters/tilt.rb', line 11
def initialize(options)
options ||= {}
@template_options = options[:template_options] || {}
@template_cache = options[:template_cache] || self.class.template_cache
end
|
Class Method Details
.template_cache ⇒ Object
7
8
9
|
# File 'lib/valise/adapters/tilt.rb', line 7
def self.template_cache
@template_cache ||= ::Tilt::Cache.new
end
|
Instance Method Details
#dump(item) ⇒ Object
17
18
19
|
# File 'lib/valise/adapters/tilt.rb', line 17
def dump(item)
super.data
end
|
#load(item) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/valise/adapters/tilt.rb', line 21
def load(item)
@template_cache.fetch(item.full_path, @template_options) do
::Tilt.new(item.full_path, @template_options) do |tmpl|
super
end
end
end
|