class Contracts::Noop::Loader

Public Class Methods

new(load_strategy, rescue_strategy) click to toggle source
# File lib/contracts/noop/loader.rb, line 4
def initialize(load_strategy, rescue_strategy)
  @load_strategy = load_strategy
  @rescue_strategy = rescue_strategy
end

Public Instance Methods

load(&blk) click to toggle source
# File lib/contracts/noop/loader.rb, line 9
def load(&blk)
  blk.call if _load
end

Private Instance Methods

_load() click to toggle source
# File lib/contracts/noop/loader.rb, line 15
def _load
  @load_strategy.call
  true
rescue LoadError
  @rescue_strategy.call
  false
end