LeadSimple / boring-service

A simple implementation of the service-object pattern
MIT License
0 stars 1 forks source link

:sparkles: feat: Support multi-types parameters #3

Closed Andy9822 closed 2 months ago

Andy9822 commented 3 months ago

Now parameters can be defined with an array of types. At runtime, if the passed argument has a type present in the array of type, it will be considered a valid parameter.

This allows cases such as:

class CalculatorService < BoringService
  parameter :num_1, [Float, Integer]
  parameter :num_2, [Float, Integer]

  def call
    puts "Sum of #{num_1} and #{num_2} is equal to #{num1 + num_2}"     
  end
end

Closes #2