Sha256: b93389428dd29dc0f046695cf78974870efcad105e0cb5c0cd174afdd7c3ac4b

Contents?: true

Size: 453 Bytes

Versions: 4

Compression:

Stored size: 453 Bytes

Contents

# frozen_string_literal: true

module CodeAnalyzer
  # Fake nil.
  class Nil
    # hash_size is 0.
    def hash_size
      0
    end

    # array_size is 0.
    def array_size
      0
    end

    # return self for to_s.
    def to_s
      self
    end

    # false
    def present?
      false
    end

    # true
    def blank?
      true
    end

    # return self.
    def method_missing(method_sym, *arguments, &block)
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
code_analyzer-0.5.5 lib/code_analyzer/nil.rb
code_analyzer-0.5.4 lib/code_analyzer/nil.rb
code_analyzer-0.5.3 lib/code_analyzer/nil.rb
code_analyzer-0.5.2 lib/code_analyzer/nil.rb