Sha256: 641850acb7a7e13a3be3e2797045e9fce90d6fcb74d8d8f154faec43dbd7dedb

Contents?: true

Size: 266 Bytes

Versions: 1

Compression:

Stored size: 266 Bytes

Contents

# frozen_string_literal: true

class String
  def clamped(whitelist, strict: true)
    is_included = proc do |item|
      if strict
        item == self
      else
        item.to_s == self
      end
    end

    return self if whitelist.any?(is_included)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clamped-0.1.0 lib/clamped/string.rb