Sha256: f36e8967b183de1067a45ea8fb47d6fd18451339940c383a58b52277fe75c0bd
Contents?: true
Size: 371 Bytes
Versions: 4
Compression:
Stored size: 371 Bytes
Contents
# frozen_string_literal: true module Strict module Interfaces class Coercer attr_reader :interface_class def initialize(interface_class) @interface_class = interface_class end def call(value) return value if value.nil? || value.instance_of?(interface_class) interface_class.new(value) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
strict-1.5.0 | lib/strict/interfaces/coercer.rb |
strict-1.4.0 | lib/strict/interfaces/coercer.rb |
strict-1.3.1 | lib/strict/interfaces/coercer.rb |
strict-1.3.0 | lib/strict/interfaces/coercer.rb |