Togglefy::FeatureManager
The Togglefy::FeatureManager class provides methods to manage features, including creating, updating, deleting and toggling their status.
For all methods here, excpet the create, you need to initialize the feature by passing the identifier before you can actually call the method.
See the examples on each method.
Methods
Section titled “Methods”create
Section titled “create”Description
Create a new feature.
Alias
create_featureParameters
name: String # Requiredidentifier: Symbol, String, nildescription: String, nilgroup: String, Symbol, nilenvironment: String, Symbol, niltenant_id: String, nilstatus: String, Symbol, Integer, nil # Default to 0 or inactiveUsage Examples
Togglefy.create( name: "Teleportation", description: "Allows the assignable to teleport to anywhere", group: :jumper, status: :active)
Togglefy.create_feature( name: "Magic", identifier: :wizardry, description: "You're a Wizard, Harry")
Togglefy.create( name: "Super Powers", description: "With great power comes great responsibility", tenant_id: "123abc", group: :admin, environment: :production)Return
Togglefy::Featureupdate
Section titled “update”Description
Update an existing feature.
Alias
update_featureParameters
First parameter, which is positional:
identifier: Symbol, StringOther parameters, which are keyword arguments:
name: String # Requiredidentifier: Symbol, String, nildescription: String, nilgroup: String, Symbol, nilenvironment: String, Symbol, niltenant_id: String, nilstatus: String, Symbol, Integer, nil # Default to 0 or inactiveUsage Examples
Togglefy.update(:teleportation, name: "Teleportation 2.0", identifier: :teleportation_2)Togglefy.update_feature(:teleportation, status: :inactive)Togglefy.update(:teleportation, status: :active, group: :powers)Return
Togglefy::Featuredestroy
Section titled “destroy”Description
Delete a feature.
Alias
destroy_featureParameters
identifier: Symbol, StringUsage Examples
Togglefy.destroy(:teleportation)Togglefy.destroy_feature(:teleportation)Return
Togglefy::Featuretoggle
Section titled “toggle”Description
Toggle the status of a feature.
Alias
toggle_featureParameters
identifier: Symbol, StringUsage Examples
Togglefy.toggle(:teleportation)Togglefy.toggle_feature(:teleportation)Return
Togglefy::Featureactive!
Section titled “active!”Description
Set the status of a feature to active.
Alias
activate_featureParameters
identifier: Symbol, StringUsage Examples
Togglefy.active!(:teleportation)Togglefy.activate_feature(:teleportation)Return
Togglefy::Featureinactive!
Section titled “inactive!”Description
Set the status of a feature to inactive.
Alias
inactivate_featureParameters
identifier: Symbol, StringUsage Examples
Togglefy.inactive!(:teleportation)Togglefy.inactivate_feature(:teleportation)Return
Togglefy::Feature