class Representable::Option
Extend ‘Trailblazer::Option` to support static values as callables too.
Public Class Methods
Source
# File lib/representable/option.rb, line 10 def self.build(value) return ->(*) { value } unless callable?(value) # Wrap static `value` into a proc. super end
Calls superclass method
Source
# File lib/representable/option.rb, line 6 def self.callable?(value) [Proc, Symbol, Uber::Callable].any?{ |kind| value.is_a?(kind) } end