Class: Liquid2::Undefined
- Inherits:
-
Object
- Object
- Liquid2::Undefined
- Includes:
- Enumerable
- Defined in:
- lib/liquid2/undefined.rb
Overview
The default undefined type. Can be iterated over an indexed without error.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#force_default ⇒ Object
readonly
Returns the value of attribute force_default.
Instance Method Summary collapse
- #! ⇒ Object
- #+@ ⇒ Object
- #-@ ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #[] ⇒ Object
-
#each ⇒ Object
rubocop:disable Lint/EmptyBlock.
-
#each_with_index ⇒ Object
rubocop:disable Lint/EmptyBlock.
- #fetch ⇒ Object
- #include? ⇒ Boolean
-
#initialize(name, node: nil) ⇒ Undefined
constructor
A new instance of Undefined.
- #join ⇒ Object
- #key? ⇒ Boolean
- #length ⇒ Object
- #member? ⇒ Boolean
- #poke ⇒ Object
- #size ⇒ Object
- #to_f ⇒ Object
- #to_i ⇒ Object
- #to_liquid(_context) ⇒ Object
- #to_s ⇒ Object
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_default ⇒ Object (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 |
#each ⇒ Object
rubocop:disable Lint/EmptyBlock
33 |
# File 'lib/liquid2/undefined.rb', line 33 def each(...) = Enumerator.new {} # rubocop:disable Lint/EmptyBlock |
#each_with_index ⇒ Object
rubocop:disable Lint/EmptyBlock
34 |
# File 'lib/liquid2/undefined.rb', line 34 def each_with_index(...) = Enumerator.new {} # rubocop:disable Lint/EmptyBlock |
#fetch ⇒ Object
22 |
# File 'lib/liquid2/undefined.rb', line 22 def fetch(...) = self |
#include? ⇒ Boolean
20 |
# File 'lib/liquid2/undefined.rb', line 20 def include?(...) = false |
#join ⇒ Object
35 |
# File 'lib/liquid2/undefined.rb', line 35 def join(...) = "" |
#key? ⇒ Boolean
19 |
# File 'lib/liquid2/undefined.rb', line 19 def key?(...) = false |
#length ⇒ Object
27 |
# File 'lib/liquid2/undefined.rb', line 27 def length = 0 |
#member? ⇒ Boolean
21 |
# File 'lib/liquid2/undefined.rb', line 21 def member?(...) = false |
#poke ⇒ Object
37 |
# File 'lib/liquid2/undefined.rb', line 37 def poke = true |
#size ⇒ Object
26 |
# File 'lib/liquid2/undefined.rb', line 26 def size = 0 |
#to_f ⇒ Object
30 |
# File 'lib/liquid2/undefined.rb', line 30 def to_f = 0.0 |
#to_i ⇒ Object
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_s ⇒ Object
28 |
# File 'lib/liquid2/undefined.rb', line 28 def to_s = "" |