Module: Pathway::Plugins::Base::InstanceMethods
- Extended by:
- Forwardable
- Defined in:
- lib/pathway.rb
Instance Method Summary collapse
- #call ⇒ Object
- #error(type, message: nil, details: nil) ⇒ Object
- #result_key ⇒ Object
- #wrap_if_present(value, type: :not_found, message: nil, details: {}) ⇒ Object
Instance Method Details
#call ⇒ Object
102 103 104 |
# File 'lib/pathway.rb', line 102 def call(*) fail "must implement at subclass" end |
#error(type, message: nil, details: nil) ⇒ Object
110 111 112 |
# File 'lib/pathway.rb', line 110 def error(type, message: nil, details: nil) failure Error.new(type: type, message: , details: details) end |
#result_key ⇒ Object
98 99 100 |
# File 'lib/pathway.rb', line 98 def result_key self.class.result_key end |
#wrap_if_present(value, type: :not_found, message: nil, details: {}) ⇒ Object
114 115 116 |
# File 'lib/pathway.rb', line 114 def wrap_if_present(value, type: :not_found, message: nil, details: {}) value.nil? ? error(type, message: , details: details) : success(value) end |