Class: NeedfulThings::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/needful_things/engine.rb

Instance Method Summary collapse

Instance Method Details

#register(name:, otherwise:) ⇒ Object



9
10
11
# File 'lib/needful_things/engine.rb', line 9

def register(name:, otherwise:)
  requirements[name] = otherwise
end

#verify(input = {}, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/needful_things/engine.rb', line 13

def verify(input = {}, &block)
  Matcher.(
    Maybe(find_unmet(input)).fmap {|need| reason(need)}.to_result.flip,
    &block
  )
end