|
|
|
|
|
by dzsekijo
603 days ago
|
|
The post says "Most of our Ruby code reads like English, but that’s not the case when we combine multiple DateTimeFns class methods", and to illustrate this, gives the following agreeably ugly example: DateTimeFns.add_minutes(DateTimeFns.add_hours(DateTime.current, 1), 1)
Sure thing, but the syntax can be improved without restorting to refactor into instance methods: DateTime.current.then {
DateTimeFns.add_hours(_1, 1)
}.then {
DateTimeFns.add_minutes(_1, 1)
}
|
|