Class: PfeedCustomizationGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PfeedCustomizationGenerator
- Defined in:
- lib/generator/pfeed_customization/pfeed_customization_generator.rb
Instance Attribute Summary collapse
-
#past_classname ⇒ Object
readonly
Returns the value of attribute past_classname.
-
#past_varname ⇒ Object
readonly
Returns the value of attribute past_varname.
Instance Method Summary collapse
Instance Attribute Details
#past_classname ⇒ Object (readonly)
Returns the value of attribute past_classname.
2 3 4 |
# File 'lib/generator/pfeed_customization/pfeed_customization_generator.rb', line 2 def past_classname @past_classname end |
#past_varname ⇒ Object (readonly)
Returns the value of attribute past_varname.
3 4 5 |
# File 'lib/generator/pfeed_customization/pfeed_customization_generator.rb', line 3 def past_varname @past_varname end |
Instance Method Details
#initialize_pfeed_customization ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/generator/pfeed_customization/pfeed_customization_generator.rb', line 9 def initialize_pfeed_customization raise "#{model.to_s.classify} must define '#{action_name.underscore}' method" unless model.to_s.classify.constantize.methods.include? action_name.underscore @model = model @current_action = action_name.to_s.underscore @past_action = ParolkarInnovationLab::SocialNet::PfeedUtils.attempt_pass_tense(@current_action) @past = @model.downcase + '_' + @past_action @past_classname = @model.capitalize + @past_action.capitalize @past_varname = @model.downcase + '_' + @past_action.downcase @model_filename = @past + '.rb' @view_filename = '_' + @past + '.html.erb' end |
#manifest ⇒ Object
22 23 24 25 26 |
# File 'lib/generator/pfeed_customization/pfeed_customization_generator.rb', line 22 def manifest template('pfeed_model.rb', "app/models/pfeeds/#{@model_filename}") template('pfeed_view.html.erb', "app/views/pfeeds/#{@view_filename}") end |