Class: Liquid2::BuiltIn
- Inherits:
-
Object
- Object
- Liquid2::BuiltIn
- Defined in:
- lib/liquid2/context.rb
Overview
Hash-like obj for resolving built-in dynamic objs.
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/liquid2/context.rb', line 21 def [](key) case key when "now", "today" Time.now end end |
#fetch(key, default = :undefined) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/liquid2/context.rb', line 12 def fetch(key, default = :undefined) case key when "now", "today" Time.now else default end end |
#key?(key) ⇒ Boolean
8 9 10 |
# File 'lib/liquid2/context.rb', line 8 def key?(key) %w[now today].include?(key) end |