
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
determinator-context
Advanced tools
This is a gem to manage Determinator context objects.
It allows you to define the actors that will be determinated upon in a single place in the controller, where they can be tested; then, the ID to be determinated upon are decided either by pointing to an attribute in code, or with a structured setting in the feature itself.
Add this line to your application's Gemfile:
source "https://8Sshw-M7Dp0iGmkGphMxS4s7BCCuI@gem.fury.io/deliveroo/" do
gem 'determinator-context'
end
And then execute:
$ bundle
The simplest way to set up a context is to use the included helper in your controllers. For example:
class ApplicationController < ActionController::Base
include Determinator::Context::Helpers
determinator_actor(:request) do
Determinator::Models::Request.new(
uid: 'abc', customer: {guid: 'foo', sticky_guid: 'bar', session_guid: nil}
)
end
determinator_actor(:customer) do
next nil unless current_user.present?
Determinator::Models::Customer.new(
id: current_user.id,
email: current_user.email,
employee: current_user.employee
)
end
end
class MenuController < ApplicationController
include Determinator::Context::Helpers
determinator_actor(:restaurant) do
# If 'to_determinator' is a method on the model
# which returns the constructed object
restaurant.to_determinator
end
end
Then, if the feature has a structured_bucket
set, you can just use the determinator context to determinate:
determinator_context.which_variant('test_feature')
If the feature is not structured, or for some reason you want to override the structured bucket, you can do:
determinator_context.using('request.customer.guid').which_variant('test_feature')
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to GemFury.
FAQs
Unknown package
We found that determinator-context 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.