
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Funcml-core extends the standard Ruby classes (String, Integer, Hash, Array, etc.) to provide a framework for data structures. This framework makes it possible to perform mutations on data structures and is at the heart of the funcml-cli project.
Connected to funcml-cli, funcml-core can ingest JSON and YAML files and apply prepared mutations. Funcml-cli is part of a wider project, Karist, which aims to simplify the management of Kubernetes manifests using YAML.
However, funcml-core can be used in just about any project thanks to its super-simple, documented AP
Ruby superior to >=2.7 is required due to pattern-matching usage.
gem install funcml-core
Data structures are mutated using the #mutate function, which is loaded with the funcml-core library. It is then possible to launch a mutation on any object by specifying the mutation functions as arguments to the #mutate method.
require "funcml-core"
simple_hash = {key: "$value"}
simple_hash.mutate(value: ["a", "great", "example"])
# { key: ["a", "great", "example"] }
Many mutations are supported. Funcml-core includes:
Read the doc at Funcml.org to learn more about what funcml-core supports.
A #mutate method is implemented for each Ruby object. This method recursively applies the various mutations specified as arguments to the first call.
Funcml-core exposes mutation functions in two ways: either through additional hash keys, determined by the prefix "_", or through strings beginning with "$".
struct = {
mutations: {
first: "hello",
second: "world",
third: "!"
},
key: {
value: {
_if: [
{eq: [{_last: '$mutations'}, "!"]}
],
_concat: {
items: [
'$mutations.first',
'$mutations.second',
'$mutations.third'
],
sep: " "
}
}
}
}
struct[:key].mutate(struct)
# {value: "hello world !"}
The implementation of funcml-core is somewhat similar in idea to LISP and you will no doubt be able to find some similarities.
The functions are applied recursively: when _concat is called, all items are first mutated before _concat's own evaluation. This is relatively similar to LISP languages where "inside the code is the first part executed".
All functions are tested using original Ruby data structures. Take a look in the test folder to see all the funcml-core possibilities.
You can run the tests with the following command (test-unit).
TESTOPTS="-v" rake test
Funcml-core only extends Ruby's native classes. Under no circumstances does funcml-core handle marshal, unmarshal or file read/write operations (see funcml-cli for these parts).
Bug reports and pull requests are welcome on GitHub at https://github.com/mimopotato/funcml-core.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that funcml-core 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.