Module: Solid::Result::Expectations::Mixin::Methods

Defined in:
lib/solid/result/expectations/mixin.rb

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.to_eval(addons) ⇒ Object



31
32
33
34
35
# File 'lib/solid/result/expectations/mixin.rb', line 31

def self.to_eval(addons)
  terminal = addons.key?(:continue) ? 'true' : 'nil'

  "#{BASE}\n#{format(FACTORY, terminal: terminal)}"
end