2 Matching Annotations
- Jun 2021
Or if you're looking for a core extension that adds this to the Array class, I'd recommend the facets gem (require 'facets/array/average'). Then you can just do array.average. And, from looking at the source, it turns out they do the exact same thing as the instance_eval approach above. The only difference is that it's implemented as a method—which of course already has self pointing to itself—instead of a block): def average; return nil if empty?; reduce(:+) / length.to_f; end Main advantage of this is that it's even more concise/readable and it handles the empty? case.
- Oct 2020
I recommend folks use https://github.com/shama/bel instead of this package; we've been working hard on it for the past two years to make sure it has all the features you could want to write inline HTML. Hope it's good; closing for now!
- name changes
- recommended option/alternative
- recommended software
- want to know the rest of the story / whether a resolution/fix was ever found
- cross-linking so readers can get the full context / see the outcome/resolution
- nanohtml (library)