class MailyHerald::Context::Drop

Context Attributes drop definition for Liquid

Public Class Methods

new(attrs) click to toggle source
# File lib/maily_herald/context.rb, line 20
def initialize attrs
  @attrs = attrs
end

Public Instance Methods

[](name)
Alias for: invoke_drop
has_key?(name) click to toggle source
# File lib/maily_herald/context.rb, line 24
def has_key?(name)
  name = name.to_s

  @attrs.has_key? name
end
invoke_drop(name) click to toggle source
# File lib/maily_herald/context.rb, line 30
def invoke_drop name
  name = name.to_s

  if @attrs.has_key? name
    if @attrs[name].is_a? Hash
      Drop.new(@attrs[name])
    else
      @attrs[name].call
    end
  else
    nil
  end
end
Also aliased as: []