Sha256: fac2454fc7afa2eb50169b35c4bd631d0f0c1c9a1ea94dc2da537f1755a0f236

Contents?: true

Size: 263 Bytes

Versions: 11

Compression:

Stored size: 263 Bytes

Contents

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

    def to_s
      ''
    end

    def inspect
      'NULL'
    end
  end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
spruz-0.2.7 lib/spruz/null.rb
spruz-0.2.6 lib/spruz/null.rb
spruz-0.2.5 lib/spruz/null.rb
spruz-0.2.2 lib/spruz/null.rb
spruz-0.2.1 lib/spruz/null.rb
spruz-0.2.0 lib/spruz/null.rb
spruz-0.1.5 lib/spruz/null.rb
spruz-0.1.3 lib/spruz/null.rb
spruz-0.1.2 lib/spruz/null.rb
spruz-0.1.1 lib/spruz/null.rb
spruz-0.1.0 lib/spruz/null.rb