@@ -313,48 +313,32 @@ def try_struct(input)
313313
314314 # @param [({Symbol => Object})] args
315315 # @return [Dry::Types::Result::Success]
316- def success ( *args )
317- result ( Types ::Result ::Success , *args )
318- end
316+ def success ( *args ) = result ( Types ::Result ::Success , *args )
319317
320318 # @param [({Symbol => Object})] args
321319 # @return [Dry::Types::Result::Failure]
322- def failure ( *args )
323- result ( Types ::Result ::Failure , *args )
324- end
320+ def failure ( *args ) = result ( Types ::Result ::Failure , *args )
325321
326322 # @param [Class] klass
327323 # @param [({Symbol => Object})] args
328- def result ( klass , *args )
329- klass . new ( *args )
330- end
324+ def result ( klass , *args ) = klass . new ( *args )
331325
332326 # @return [false]
333- def default?
334- false
335- end
327+ def default? = false
336328
337329 # @param [Object, Dry::Struct] other
338330 # @return [Boolean]
339- def ===( other )
340- other . is_a? ( self )
341- end
331+ def ===( other ) = other . is_a? ( self )
342332 alias_method :primitive? , :===
343333
344334 # @return [true]
345- def constrained?
346- true
347- end
335+ def constrained? = true
348336
349337 # @return [self]
350- def primitive
351- self
352- end
338+ def primitive = self
353339
354340 # @return [false]
355- def optional?
356- false
357- end
341+ def optional? = false
358342
359343 # @return [Proc]
360344 def to_proc
@@ -365,9 +349,7 @@ def to_proc
365349 #
366350 # @param [Symbol] key Attribute name
367351 # @return [Boolean]
368- def has_attribute? ( key )
369- schema . key? ( key )
370- end
352+ def has_attribute? ( key ) = schema . key? ( key )
371353
372354 # Gets the list of attribute names
373355 #
@@ -483,10 +465,7 @@ def #{key} # def email
483465 private :define_accessors
484466
485467 # @api private
486- def valid_method_name? ( key )
487- key . to_s . match? ( /\A [a-zA-Z_]\w *\z / )
488- end
489- private :valid_method_name?
468+ private def valid_method_name? ( key ) = key . to_s . match? ( /\A [a-zA-Z_]\w *\z / )
490469 end
491470 end
492471end
0 commit comments