Sha256: b224efdcaf83b5466a41005357fadd8af61088aa0d8b6db981e860507dd098a6

Contents?: true

Size: 238 Bytes

Versions: 1

Compression:

Stored size: 238 Bytes

Contents

# encoding: UTF-8
# frozen_string_literal: true

module NilIfZero
  module Extension
    def nil_if_zero
      self unless zero?
    end

    def nil_unless_zero
      self if zero?
    end
  end
end

Integer.include NilIfZero::Extension

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nil-if-zero-1.0.0 lib/nil-if-zero.rb