
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
rns
, which stands for "Ruby namespaces", is a small library for
using classes and modules as packages of functions in order to support
functional programming in Ruby. It is inspired by
Clojure's ns
macro and namespace system.
require 'rns'
Arithmetic = Rns do
def dec(n) n - 1 end
def inc(n) n + 1 end
end
Statistics = Rns do
def avg(arr) arr.reduce(:+).to_f / arr.count end
end
class Main
Funcs = Rns(Statistics, Arithmetic => [:inc]) do
def incremented_avg(nums)
avg nums.map(&method(:inc))
end
end
def main
nums = [1, 2, 3]
puts "The average of #{nums.inspect} incremented is: #{Funcs.incremented_avg nums}"
end
end
Main.new.main
Please see the tests for more usage examples.
Ruby has good functional programming support, but the class and module
system doesn't lend itself to organizing and accessing functions.
With rns
I hope to make it at least slightly easier to build Ruby
programs primarily out of pure functions.
To Sam Umbach for helping me tame the eigenclass, and to my employer Relevance for indulging me with time to work on free software.
FAQs
Unknown package
We found that rns demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.