class ParamsReady::Parameter::TupleParameterDefinition
Public Class Methods
new(*args, separator: nil, fields: nil, **options)
click to toggle source
Calls superclass method
ParamsReady::Parameter::Definition::new
# File lib/params_ready/parameter/tuple_parameter.rb, line 113 def initialize(*args, separator: nil, fields: nil, **options) @fields = [] add_fields fields unless fields.nil? super *args, **options end
Public Instance Methods
add_fields(fields)
click to toggle source
# File lib/params_ready/parameter/tuple_parameter.rb, line 119 def add_fields(fields) fields.each do |field| add_field(field) end end
arity()
click to toggle source
# File lib/params_ready/parameter/tuple_parameter.rb, line 134 def arity @fields.length end
ensure_canonical(array)
click to toggle source
# File lib/params_ready/parameter/tuple_parameter.rb, line 138 def ensure_canonical(array) raise ParamsReadyError, "Not an array" unless array.is_a? Array context = Format.instance(:backend) marshaller = marshallers.instance(Array) value, _validator = marshaller.canonicalize(self, array, context, nil, freeze: true) value end
freeze()
click to toggle source
Calls superclass method
ParamsReady::Extensions::Freezer::InstanceMethods#freeze
# File lib/params_ready/parameter/tuple_parameter.rb, line 146 def freeze @fields.freeze super end