Sha256: 9411d86d5862cd0c69e1581139a9dceb60409ee6609751970c4f1dd75f9d14e5

Contents?: true

Size: 250 Bytes

Versions: 1

Compression:

Stored size: 250 Bytes

Contents

module Monolens
  module Str
    class NullIfEmpty
      include Lens

      signature(Type::String, Type::String)

      def call(arg, world = {})
        is_string!(arg, world)

        arg.to_s.strip.empty? ? nil : arg
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monolens-0.6.4 lib/monolens/stdlib/str/null_if_empty.rb