@@ -313,48 +313,32 @@ def try_struct(input)
313
313
314
314
# @param [({Symbol => Object})] args
315
315
# @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 )
319
317
320
318
# @param [({Symbol => Object})] args
321
319
# @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 )
325
321
326
322
# @param [Class] klass
327
323
# @param [({Symbol => Object})] args
328
- def result ( klass , *args )
329
- klass . new ( *args )
330
- end
324
+ def result ( klass , *args ) = klass . new ( *args )
331
325
332
326
# @return [false]
333
- def default?
334
- false
335
- end
327
+ def default? = false
336
328
337
329
# @param [Object, Dry::Struct] other
338
330
# @return [Boolean]
339
- def ===( other )
340
- other . is_a? ( self )
341
- end
331
+ def ===( other ) = other . is_a? ( self )
342
332
alias_method :primitive? , :===
343
333
344
334
# @return [true]
345
- def constrained?
346
- true
347
- end
335
+ def constrained? = true
348
336
349
337
# @return [self]
350
- def primitive
351
- self
352
- end
338
+ def primitive = self
353
339
354
340
# @return [false]
355
- def optional?
356
- false
357
- end
341
+ def optional? = false
358
342
359
343
# @return [Proc]
360
344
def to_proc
@@ -365,9 +349,7 @@ def to_proc
365
349
#
366
350
# @param [Symbol] key Attribute name
367
351
# @return [Boolean]
368
- def has_attribute? ( key )
369
- schema . key? ( key )
370
- end
352
+ def has_attribute? ( key ) = schema . key? ( key )
371
353
372
354
# Gets the list of attribute names
373
355
#
@@ -483,10 +465,7 @@ def #{key} # def email
483
465
private :define_accessors
484
466
485
467
# @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 / )
490
469
end
491
470
end
492
471
end
0 commit comments