module FrozenVoid

a source of unalterable emptiness

Constants

IMMUTABLE_EMPTY_ARRAY
IMMUTABLE_EMPTY_SET
IMMUTABLE_EMPTY_STRING

Public Class Methods

array() click to toggle source

@example is empty

an_array = FrozenVoid.array
an_array.empty? #=> true

@example cannot be added to

an_array = FrozenVoid.array
an_array.push(:warmth) #=> raise FrozenError, "can't modify frozen Array: []"

@example is the same object as some other array from the void

an_array = FrozenVoid.array
another_array = FrozenVoid.array
an_array.equal?(another_array) #=> true

@return [Array] never to be filled

# File lib/frozen_void.rb, line 37
def self.array
  IMMUTABLE_EMPTY_ARRAY
end
set() click to toggle source

@example is empty

a_set = FrozenVoid.set
a_set.empty? #=> true

@example cannot be added to

a_set = FrozenVoid.set
a_set.add(:warmth) #=> raise FrozenError, "can't modify frozen Hash: {}"

@example is the same object as some other set from the void

a_set = FrozenVoid.set
another_set = FrozenVoid.set
a_set.equal?(another_set) #=> true

@return [Set] eternally empty

# File lib/frozen_void.rb, line 19
def self.set
  FrozenVoid::Set.new
end
string() click to toggle source

@example is empty

a_string = FrozenVoid.string
a_string.empty? #=> true

@example cannot be modified

a_string = FrozenVoid.string
a_string.upcase! #=> raise FrozenError, "can't modify frozen String: \"\""

@example is the same object as some other string from the void

a_string = FrozenVoid.string
another_string = FrozenVoid.string
a_string.equal?(another_string) #=> true

@return [String] forever bereft of character

# File lib/frozen_void.rb, line 55
def self.string
  IMMUTABLE_EMPTY_STRING
end