
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Symbolized provides a Hash with indifferent access, but with keys stored internally as symbols. This is particularly useful when you have a very big amount of hashes that share the same keys, and it may become inefficient to keep all these identical keys as strings. An example of this case is when you have data processing pipelines that process millions of hashes with the same keys.
You can either install it manually:
% [sudo] gem install symbolized
Or include it in your Gemfile:
gem 'symbolized'
And then run bundle install
.
require 'symbolized'
# You can create a SymbolizedHash directly:
symbolized_hash = SymbolizedHash.new
symbolized_hash['a'] = 'b'
symbolized_hash['a'] #=> 'b'
symbolized_hash[:a] #=> 'b'
symbolized_hash.keys #=> [:a]
# Or initialize it with a normal hash:
symbolized_hash = SymbolizedHash.new({'a' => 'b'})
symbolized_hash['a'] #=> 'b'
symbolized_hash[:a] #=> 'b'
symbolized_hash.keys #=> [:a]
# Or use the Hash#to_symbolized_hash core extension:
h = { 'a' => 'b' }
h['a'] #=> 'b'
h[:a] #=> nil
h.keys #=> ['a']
symbolized_hash = h.to_symbolized_hash
symbolized_hash['a'] #=> 'b'
symbolized_hash[:a] #=> 'b'
symbolized_hash.keys #=> [:a]
The gem provides almost the same methods and functionality provided by ActiveSupport's HashWithIndifferentAccess
, while storing keys internally as Symbols.
ActiveSupport
CompatibilityThis gem is built with intent to be as much as possible compatible with ActiveSupport. You can include both Symbolized
and ActiveSupport
, and you are guaranteed to get ActiveSupport functionality and core extensions, and still have Symbolized
core extension and class.
Checkout travis.yml to see which Ruby versions the gem has been tested against. Alternatively, if you want to test it yourself, you can clone the repo, run bundle install
and then run rake test
.
Please propose suggestions, open discussions, or report bugs and issues here.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)The current code of this gem is heavily based on ActiveSupport 4.2 HashWithIndifferentAccess. Some parts are direct clones, other parts have been modified and/or refactored.
Copyright (c) 2015 Tamer Shlash (@TamerShlash). Released under the MIT License.
FAQs
Unknown package
We found that symbolized 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.