Class: Generators::Avo::Card

Inherits:
NamedBaseGenerator show all
Defined in:
lib/generators/avo/card_generator.rb

Instance Method Summary collapse

Methods inherited from NamedBaseGenerator

#initialize

Constructor Details

This class inherits a constructor from Generators::Avo::NamedBaseGenerator

Instance Method Details

#handleObject



10
11
12
13
14
15
16
17
18
# File 'lib/generators/avo/card_generator.rb', line 10

def handle
  raise "Invalid card type '#{options[:type]}'" unless card_types.include? options[:type]

  template "cards/#{options[:type]}_card_sample.tt", "app/avo/cards/#{name.underscore}.rb"

  if options[:type].to_sym == :partial
    template "cards/partial_card_partial.tt", "app/views/avo/cards/_#{name.underscore}.html.erb"
  end
end