Sha256: 6b28bd17d0986466b7b7c7f8a048ffed23c0463297c28189d4c0e00dfb49b0d7
Contents?: true
Size: 728 Bytes
Versions: 16
Compression:
Stored size: 728 Bytes
Contents
# frozen_string_literal: true module StimulusReflex class ReflexMethodInvocationPolicy attr_reader :arguments, :required_params, :optional_params def initialize(method, arguments) @arguments = arguments @required_params = method.parameters.select { |(kind, _)| kind == :req } @optional_params = method.parameters.select { |(kind, _)| kind == :opt } end def no_arguments? arguments.size == 0 && required_params.size == 0 end def arguments? arguments.size >= required_params.size && arguments.size <= required_params.size + optional_params.size end def unknown? return false if no_arguments? return false if arguments? true end end end
Version data entries
16 entries across 16 versions & 1 rubygems