Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/clamped/string.rb
Instance Method Summary collapse
Instance Method Details
#clamped(whitelist, strict: true, default: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/clamped/string.rb', line 4 def clamped(whitelist, strict: true, default: nil) is_included = proc do |item| if strict item == self else item.to_s == self end end return self if whitelist.any?(is_included) default end |