Sha256: 0ad1e0ba31978526301a97667be56be9535f192a0b3c5e07a00b2f70b19162d2
Contents?: true
Size: 425 Bytes
Versions: 2
Compression:
Stored size: 425 Bytes
Contents
module RiceBubble class Attributes class Optional < Base attr_reader :child def initialize(child, &) super(&) @child = child end def valid?(value) value.nil? || child.valid?(value) end def call(value, path: '') value && child.call(value, path:) end def description "#{child.description} (optional)" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rice_bubble-0.2.1 | lib/rice_bubble/attributes/optional.rb |
rice_bubble-0.2.0 | lib/rice_bubble/attributes/optional.rb |