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_feature
Parameters
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 inactive
Usage 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::Feature
update
Section titled “update”Description
Update an existing feature.
Alias
update_feature
Parameters
First parameter, which is positional:
identifier: Symbol, String
Other 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 inactive
Usage 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::Feature
destroy
Section titled “destroy”Description
Delete a feature.
Alias
destroy_feature
Parameters
identifier: Symbol, String
Usage Examples
Togglefy.destroy(:teleportation)Togglefy.destroy_feature(:teleportation)
Return
Togglefy::Feature
toggle
Section titled “toggle”Description
Toggle the status of a feature.
Alias
toggle_feature
Parameters
identifier: Symbol, String
Usage Examples
Togglefy.toggle(:teleportation)Togglefy.toggle_feature(:teleportation)
Return
Togglefy::Feature
active!
Section titled “active!”Description
Set the status of a feature to active.
Alias
activate_feature
Parameters
identifier: Symbol, String
Usage Examples
Togglefy.active!(:teleportation)Togglefy.activate_feature(:teleportation)
Return
Togglefy::Feature
inactive!
Section titled “inactive!”Description
Set the status of a feature to inactive.
Alias
inactivate_feature
Parameters
identifier: Symbol, String
Usage Examples
Togglefy.inactive!(:teleportation)Togglefy.inactivate_feature(:teleportation)
Return
Togglefy::Feature