Sha256: 8c92585a336165ffce5bd2d581ec4dabbebf7ec020341ba2af8e0c9863f00e02
Contents?: true
Size: 493 Bytes
Versions: 5
Compression:
Stored size: 493 Bytes
Contents
require "trailblazer/option" module Representable # Extend `Trailblazer::Option` to support static values as callables too. class Option < ::Trailblazer::Option def self.callable?(value) [Proc, Symbol, Uber::Callable].any?{ |kind| value.is_a?(kind) } end def self.build(value) return ->(*) { value } unless callable?(value) # Wrap static `value` into a proc. super end end def self.Option(value) ::Representable::Option.build(value) end end
Version data entries
5 entries across 5 versions & 3 rubygems