Module: Pathway::Plugins::Base::InstanceMethods

Extended by:
Forwardable
Defined in:
lib/pathway.rb

Instance Method Summary collapse

Instance Method Details

#callObject



142
143
144
# File 'lib/pathway.rb', line 142

def call(*)
  fail 'must implement at subclass'
end

#error(type, message: nil, details: nil) ⇒ Object



146
147
148
# File 'lib/pathway.rb', line 146

def error(type, message: nil, details: nil)
  failure(Error.new(type: type, message: message, details: details))
end

#wrap_if_present(value, type: :not_found, message: nil, details: {}) ⇒ Object



150
151
152
# File 'lib/pathway.rb', line 150

def wrap_if_present(value, type: :not_found, message: nil, details: {})
  value.nil? ? error(type, message: message, details: details) : success(value)
end