Class: Liquid2::Blank

Inherits:
Expression show all
Defined in:
lib/liquid2/expressions/blank.rb

Overview

The special value blank.

Instance Attribute Summary

Attributes inherited from Expression

#token

Instance Method Summary collapse

Methods inherited from Expression

#children, #initialize, #scope

Constructor Details

This class inherits a constructor from Liquid2::Expression

Instance Method Details

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



12
13
14
15
16
17
18
# File 'lib/liquid2/expressions/blank.rb', line 12

def ==(other)
  return true if other.is_a?(String) && (other.empty? || other.match?(/\A\s+\Z/))

  return other.empty? if other.respond_to?(:empty?)

  other.is_a?(Blank)
end

#evaluate(_context) ⇒ Object



8
9
10
# File 'lib/liquid2/expressions/blank.rb', line 8

def evaluate(_context)
  self
end

#to_sObject



22
# File 'lib/liquid2/expressions/blank.rb', line 22

def to_s = ""