Sha256: da95108001d6eb82e2aad0f7f5fa8b7c4c5647f450794072552195f0bb6607ed

Contents?: true

Size: 408 Bytes

Versions: 2

Compression:

Stored size: 408 Bytes

Contents

# encoding: utf-8
module RailsBestPractices
  module Core
    # 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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_best_practices-1.3.0 lib/rails_best_practices/core/nil.rb
rails_best_practices-1.2.0 lib/rails_best_practices/core/nil.rb