Sha256: f006202d990680c788d6471ad08883d1cf2d5a8d2ea29e6365086021b405e10e

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 Bytes

Contents

# encoding: utf-8
require "naught"

module ServiceObjects #:nodoc:

  # Implements Null Object pattern
  #
  # @note
  #   The constant is a singleton black hole object that returns
  #   itself to any method call
  #
  # @example
  #   ServiceObjects::NULL.respond_to? :arbitrary_method
  #   # => true
  #
  #   ServiceObjects::NULL.arbitrary_method
  #   # => ServiceObjects::NULL
  #
  # @see https://github.com/avdi/naught
  #   documentation for the 'naught' gem by Avdi Grimm
  NULL = Naught.build do |config|
    config.black_hole
    config.singleton
  end.instance

end # module ServiceObjects

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
service_objects-0.1.0 lib/service_objects/null.rb
service_objects-0.0.2 lib/service_objects/null.rb
service_objects-0.0.1 lib/service_objects/null.rb