Class: Generators::Avo::Card
- Inherits:
-
NamedBaseGenerator
- Object
- Rails::Generators::NamedBase
- NamedBaseGenerator
- Generators::Avo::Card
- Defined in:
- lib/generators/avo/card_generator.rb
Instance Method Summary collapse
Methods inherited from NamedBaseGenerator
Constructor Details
This class inherits a constructor from Generators::Avo::NamedBaseGenerator
Instance Method Details
#handle ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/avo/card_generator.rb', line 10 def handle raise "Invalid card type '#{[:type]}'" unless card_types.include? [:type] template "cards/#{[:type]}_card_sample.tt", "app/avo/cards/#{name.underscore}.rb" if [:type].to_sym == :partial template "cards/partial_card_partial.tt", "app/views/avo/cards/_#{name.underscore}.html.erb" end end |