Sha256: a6f34d569d4ac00c6c92dd8cd1fc9e93da9218d1ae85aa20e26428972e06a5b1

Contents?: true

Size: 328 Bytes

Versions: 4

Compression:

Stored size: 328 Bytes

Contents

module Tins
  # Implementation of the null object pattern in Ruby.
  module Null
    def method_missing(*)
      self
    end

    def const_missing(*)
      self
    end

    def to_s
      ''
    end

    def inspect
      'NULL'
    end
  end

  NULL = Class.new do
    include Tins::Null
  end.new
end

require 'tins/alias'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tins-0.3.3 lib/tins/null.rb
tins-0.3.2 lib/tins/null.rb
tins-0.3.1 lib/tins/null.rb
tins-0.3.0 lib/tins/null.rb