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
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/generators/rails_feature_flip/feature/feature_generator.rb', line 12 def generate_feature @name = name.underscore.downcase @klass_name = class_name @attributes = attributes @boolean_attributes = @attributes.collect { |attr| attr if attr.type == :boolean }.compact feature_file_path = Rails.root.join('config', 'features') feature_path = feature_file_path.join("#{@name}_feature.rb") template('feature.erb', feature_path) end |