Class: Liquid2::StrictUndefined

Inherits:
Undefined show all
Defined in:
lib/liquid2/undefined.rb

Overview

An undefined type that always raises an exception.

Direct Known Subclasses

StrictDefaultUndefined

Instance Attribute Summary

Attributes inherited from Undefined

#force_default

Instance Method Summary collapse

Constructor Details

#initialize(name, node: nil) ⇒ StrictUndefined



42
43
44
45
# File 'lib/liquid2/undefined.rb', line 42

def initialize(name, node: nil)
  super
  @message = "#{@node.is_a?(Path) ? @node : name.inspect} is undefined"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject

Raises:



49
50
51
# File 'lib/liquid2/undefined.rb', line 49

def method_missing(...)
  raise UndefinedError.new(@message, @node.token)
end

Instance Method Details

#!Object

Raises:



73
74
75
# File 'lib/liquid2/undefined.rb', line 73

def !
  raise UndefinedError.new(@message, @node.token)
end

#!=(_other) ⇒ Object

Raises:



81
82
83
# File 'lib/liquid2/undefined.rb', line 81

def !=(_other)
  raise UndefinedError.new(@message, @node.token)
end

#+@Object



107
108
109
# File 'lib/liquid2/undefined.rb', line 107

def +@
  self
end

#-@Object



111
112
113
# File 'lib/liquid2/undefined.rb', line 111

def -@
  self
end

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

Raises:



77
78
79
# File 'lib/liquid2/undefined.rb', line 77

def ==(_other)
  raise UndefinedError.new(@message, @node.token)
end

#[]Object

Raises:



53
54
55
# File 'lib/liquid2/undefined.rb', line 53

def [](...)
  raise UndefinedError.new(@message, @node.token)
end

#eachObject

Raises:



115
116
117
# File 'lib/liquid2/undefined.rb', line 115

def each(...)
  raise UndefinedError.new(@message, @node.token)
end

#each_with_indexObject

Raises:



119
120
121
# File 'lib/liquid2/undefined.rb', line 119

def each_with_index(...)
  raise UndefinedError.new(@message, @node.token)
end

#fetchObject

Raises:



69
70
71
# File 'lib/liquid2/undefined.rb', line 69

def fetch(...)
  raise UndefinedError.new(@message, @node.token)
end

#include?Boolean

Raises:



61
62
63
# File 'lib/liquid2/undefined.rb', line 61

def include?(...)
  raise UndefinedError.new(@message, @node.token)
end

#joinObject

Raises:



123
124
125
# File 'lib/liquid2/undefined.rb', line 123

def join(...)
  raise UndefinedError.new(@message, @node.token)
end

#key?Boolean

Raises:



57
58
59
# File 'lib/liquid2/undefined.rb', line 57

def key?(...)
  raise UndefinedError.new(@message, @node.token)
end

#lengthObject

Raises:



91
92
93
# File 'lib/liquid2/undefined.rb', line 91

def length
  raise UndefinedError.new(@message, @node.token)
end

#member?Boolean

Raises:



65
66
67
# File 'lib/liquid2/undefined.rb', line 65

def member?(...)
  raise UndefinedError.new(@message, @node.token)
end

#pokeObject

Raises:



131
132
133
# File 'lib/liquid2/undefined.rb', line 131

def poke
  raise UndefinedError.new(@message, @node.token)
end

#respond_to_missing?Boolean



47
# File 'lib/liquid2/undefined.rb', line 47

def respond_to_missing? = true

#sizeObject

Raises:



87
88
89
# File 'lib/liquid2/undefined.rb', line 87

def size
  raise UndefinedError.new(@message, @node.token)
end

#to_fObject

Raises:



103
104
105
# File 'lib/liquid2/undefined.rb', line 103

def to_f
  raise UndefinedError.new(@message, @node.token)
end

#to_iObject

Raises:



99
100
101
# File 'lib/liquid2/undefined.rb', line 99

def to_i
  raise UndefinedError.new(@message, @node.token)
end

#to_liquid(_context) ⇒ Object



127
128
129
# File 'lib/liquid2/undefined.rb', line 127

def to_liquid(_context)
  self
end

#to_sObject

Raises:



95
96
97
# File 'lib/liquid2/undefined.rb', line 95

def to_s
  raise UndefinedError.new(@message, @node.token)
end