
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
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 new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.