I’m just wondering, is something changed lately or I mixed up something. Let’s assume I’ve got below class:
require 'dry-monads'
require 'dry/monads/all'
module Test
class MonadsClass
include Dry::Monads
def initialize(signees)
@signees = signees
end
def call
Success(signees)
.bind(method(:fetch_template))
.bind(method(:envelope_from_template))
end
attr_reader :signees
private
def fetch_template(signees)
key = "template_#{signees.size}".to_sym
template_id = Rails.application.credentials.some_api.fetch(key)
Success(template_id: template_id, key: key)
end
def envelope_from_template(template_id:, key:)
response = some_api.copy_from_template(template_id, key)
response.failure? ? Failure(response.failure) : Success(response.value!)
end
end
end
Why on earth I’m getting strange error of:
Failure/Error:
def envelope_from_template(template_id:, key:)
response = some_api.copy_from_template(template_id)
response.failure? ? Failure(response.failure) : Success(response.value!)
end
ArgumentError:
wrong number of arguments (given 1, expected 0; required keywords: template_id, key)```
It's not allowed anymore to passed more argument than the first `bind` one?