Sha256: ff6f6f1340410e084f372d3d33a3f80217da69f0db73130bcda260688dabc269
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true class BCDD::Result module Expectations::Mixin module Factory def self.module! ::Module.new do def self.included(base); base.const_set(:ResultExpectationsMixin, self); end def self.extended(base); base.const_set(:ResultExpectationsMixin, self); end end end end module Methods BASE = <<~RUBY def Success(...) _Result.Success(...) end def Failure(...) _Result.Failure(...) end RUBY FACTORY = <<~RUBY private def _Result @_Result ||= Result.with(source: self, terminal: %<terminal>s) end RUBY def self.to_eval(addons) terminal = addons.key?(:continue) ? 'true' : 'nil' "#{BASE}\n#{format(FACTORY, terminal: terminal)}" end end module Addons module Continue private def Continue(value) _Result.Success(IgnoredTypes::CONTINUE, value) end end module Given private def Given(value) _Result.Success(IgnoredTypes::GIVEN, value) end end OPTIONS = { continue: Continue, given: Given }.freeze def self.options(config_flags) Config::Options.addon(map: config_flags, from: OPTIONS) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bcdd-result-1.1.0 | lib/bcdd/result/expectations/mixin.rb |
bcdd-result-1.0.0 | lib/bcdd/result/expectations/mixin.rb |
bcdd-result-0.13.0 | lib/bcdd/result/expectations/mixin.rb |