Class: Liquid::SelfDrop

Inherits:
Drop
  • Object
show all
Defined in:
lib/liquid/self_drop.rb

Instance Attribute Summary

Attributes inherited from Drop

#context

Instance Method Summary collapse

Methods inherited from Drop

#inspect, invokable?, invokable_methods, #invoke_drop, #liquid_method_missing, #to_s

Constructor Details

#initialize(self_context) ⇒ SelfDrop

Returns a new instance of SelfDrop.



19
20
21
22
# File 'lib/liquid/self_drop.rb', line 19

def initialize(self_context)
  super()
  @self_context = self_context
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



38
39
40
# File 'lib/liquid/self_drop.rb', line 38

def ==(other)
  other.is_a?(SelfDrop) && other.self_context.equal?(@self_context)
end

#[](key) ⇒ Object



24
25
26
27
28
# File 'lib/liquid/self_drop.rb', line 24

def [](key)
  @self_context.find_variable(key)
rescue UndefinedVariable
  nil
end

#hashObject



44
45
46
# File 'lib/liquid/self_drop.rb', line 44

def hash
  @self_context.object_id.hash
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/liquid/self_drop.rb', line 30

def key?(key)
  @self_context.variable_defined?(key)
end

#to_liquidObject



34
35
36
# File 'lib/liquid/self_drop.rb', line 34

def to_liquid
  self
end