Class: RailsFeatureFlip::Generators::FeatureGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- RailsFeatureFlip::Generators::FeatureGenerator
- Defined in:
- lib/generators/rails_feature_flip/feature/feature_generator.rb
Overview
Generates a feature file under config/features to configure a feature of the app
Instance Method Summary collapse
-
#generate_feature ⇒ Object
Generate a feature.
Instance Method Details
#generate_feature ⇒ Object
Generate a feature
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/rails_feature_flip/feature/feature_generator.rb', line 18 def generate_feature @name = name.underscore.downcase parts = class_name.split('::') @namespace_parts = parts[0..-2] @feature_class_name = "#{parts.last}Feature" @attributes = prepend_enabled_attribute(attributes) @boolean_attributes = @attributes.select { |attr| attr.type == :boolean } @defaults = [:defaults] template('feature.erb', "config/features/#{@name}_feature.rb") end |