Sha256: 437af0a7856088cb02cebf3dace924c0e43bcc7203d1331ffa1e0c1e9f84df0a

Contents?: true

Size: 509 Bytes

Versions: 3

Compression:

Stored size: 509 Bytes

Contents

class Lina::ViewGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)
  argument :actions, type: :array, default: [], banner: "action1 action2"

  desc "Create lina view(s)"

  def copy_view_files
    base_path = File.join("app/views", class_path, file_name)
    empty_directory base_path

    actions.each do |action|
      @action = action
      @path = File.join(base_path, "#{action}.json.jbuilder")
      template 'view.json.jbuilder', @path
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lina-0.0.4 lib/generators/lina/view/view_generator.rb
lina-0.0.3 lib/generators/lina/view/view_generator.rb
lina-0.0.2 lib/generators/lina/view/view_generator.rb