facets
facets copied to clipboard
Ruby Facets
Currently if you try this code: ```ruby require 'facets/math/gini_coefficient' a = (1..10).to_a Math::gini_coefficient(a) ``` It will throw this error: ``` lib/standard/facets/math/gini_coefficient.rb:16:in `gini_coefficient': undefined local variable or method `size' for Math:Module...
RubyGems.org does nothing with this directive. Can be removed without a replacement.
What the title says. I needed this to build CSS classes from Ruby class names by convention in [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal). You may read the Pull Request commit code...
Like `Array#index`/`rindex` but returns _all_ indexes instead of just the first/last. This would be useful to have until https://bugs.ruby-lang.org/issues/6596 gets accepted.
## Motivation There are many cases when 1. "duplicate" elements in an array are allowed and 2. both the number and order of those elements is important (for example, `'racecar'.chars`)....
I changed Module#attr_setter to adapt it to frozen-string-literal. This PR is to fix #286 .
I needed this code for a project and figured I'd offer it up to facets I originally found this code at https://dzone.com/articles/convert-ruby-array-ranges but it didn't actually work as described, so...
The method converts an associative array to a Proc which calls chain of methods on a given object. I use it mostly with enums in irb and specs as a...