Class: Liquid2::Undefined

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/liquid2/undefined.rb

Overview

The default undefined type. Can be iterated over an indexed without error.

Direct Known Subclasses

StrictUndefined

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, node: nil) ⇒ Undefined

Returns a new instance of Undefined.



12
13
14
15
16
# File 'lib/liquid2/undefined.rb', line 12

def initialize(name, node: nil)
  @name = name
  @node = node
  @force_default = false
end

Instance Attribute Details

#force_defaultObject (readonly)

Returns the value of attribute force_default.



10
11
12
# File 'lib/liquid2/undefined.rb', line 10

def force_default
  @force_default
end

Instance Method Details

#!Object



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

def ! = true

#+@Object



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

def +@ = self

#-@Object



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

def -@ = self

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



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

def ==(other) = other.nil? || other.is_a?(Undefined)

#[]Object



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

def [](...) = self

#eachObject

rubocop:disable Lint/EmptyBlock



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

def each(...) = Enumerator.new {} # rubocop:disable Lint/EmptyBlock

#each_with_indexObject

rubocop:disable Lint/EmptyBlock



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

def each_with_index(...) = Enumerator.new {} # rubocop:disable Lint/EmptyBlock

#fetchObject



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

def fetch(...) = self

#include?Boolean

Returns:

  • (Boolean)


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

def include?(...) = false

#joinObject



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

def join(...) = ""

#key?Boolean

Returns:

  • (Boolean)


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

def key?(...) = false

#lengthObject



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

def length = 0

#member?Boolean

Returns:

  • (Boolean)


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

def member?(...) = false

#pokeObject



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

def poke = true

#sizeObject



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

def size = 0

#to_fObject



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

def to_f = 0.0

#to_iObject



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

def to_i = 0

#to_liquid(_context) ⇒ Object



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

def to_liquid(_context) = nil

#to_sObject



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

def to_s = ""