Sha256: c58bf819e5b02c88f45911db3ae2a36d24e976b6e52ef06fa66a91e4e813eca6
Contents?: true
Size: 587 Bytes
Versions: 20
Compression:
Stored size: 587 Bytes
Contents
# frozen_string_literal: true String.class_eval do # Calls `to_i` and returns the value if it is positive # # @return [Integer, Nil] # def to_positive_i val = to_i return unless val.positive? val end end Numeric.class_eval do # Calls `to_i` and returns the value if it is positive # # @return [Integer, Nil] # def to_positive_i val = to_i return unless val.positive? val end end NilClass.class_eval do # Calls `to_i` and returns the value if it is positive # # @return [Integer, Nil] # def to_positive_i nil end end
Version data entries
20 entries across 20 versions & 1 rubygems