Class: Dimples::Context
- Inherits:
-
Object
- Object
- Dimples::Context
- Defined in:
- lib/dimples/context.rb
Overview
Context used when rendering an item in a template
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dimples/context.rb', line 6 def self.from_hash(hash) hash.transform_values! { |value| value.is_a?(Hash) ? Context.from_hash(value) : value } Struct.new(*hash.keys) do |_klass| def method_missing(_method_name, *_args) nil end def respond_to_missing?(_method_name, _include_private = false) true end end.new(*hash.values) end |