Method: Funkr::Types::Failable#apply

Defined in:
lib/funkr/types/failable.rb

#apply(to) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/funkr/types/failable.rb', line 29

def apply(to)
  self.match do |f_on|
    f_on.ok do |f|
      to.match do |t_on|
        t_on.ok {|t| self.class.ok(f.call(t)) }
        t_on.failed { to }
      end
    end
    f_on.failed { self }
  end
end