class ViewComponent::Base
def validate_collection_parameter!(validate_default: false)
- Private: - TODO: add documentation
def validate_collection_parameter!(validate_default: false) parameter = validate_default ? collection_parameter : provided_collection_parameter return unless parameter return if initialize_parameter_names.include?(parameter) || splatted_keyword_argument_present? # If Ruby can't parse the component class, then the initialize # parameters will be empty and ViewComponent will not be able to render # the component. if initialize_parameters.empty? raise EmptyOrInvalidInitializerError.new(name, parameter) end raise MissingCollectionArgumentError.new(name, parameter) end