
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.
SuperCurrent
takes away the need to define a Current
class and instead makes it available from anywhere in your app without having to define it.
This means that your test coverage will not suffer from ActiveSupport::CurrentAttributes
!
You can define the class name of the Current
class, so if you're already using Current
for something else, you can use a different name.
# config/initializers/super_current.rb
SuperCurrent.config.current_class_name = 'SuperCurrent'
Then you can have your existing Current
class be a subclass of SuperCurrent
and it will still work with all the exciting features of SuperCurrent
.
class Current < SuperCurrent
# ...
end
Just think up a name for your attribute and assign it! It will be created on the Current
class automatically.
Current.foo = 'bar'
Current.foo # => 'bar'
SuperCurrent
also adds the ability to use []
and []=
to access the attributes.
Current[:foo] = 'bar'
Current[:foo] # => 'bar'
Even something like Current[:foo][:bar]
will work!
# No need to define Current[:hoge] beforehand!
Current[:hoge][:bar] = "hello"
Current[:hoge][:bar] # => 'bar'
This means that you no longer need to define the attributes on the Current
class beforehand.
So if you have a class like this:
class Current < ActiveSupport::CurrentAttributes
attribute :foo
attribute :bar
attribute :baz
attribute :hoge
end
You can just delete it and enjoy the benefits of SuperCurrent
! Test coverage might go up, too!
Add this line to your application's Gemfile:
gem "super_current"
And then execute:
$ bundle
Or install it yourself as:
$ gem install super_current
Inspired by: https://wiki.php.net/rfc/deprecate_dynamic_properties
Feel free to contribute.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that super_current 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.