Class: KStarter::Questions::AskQuestions

Inherits:
Object
  • Object
show all
Defined in:
lib/k_starter/questions/ask_questions.rb

Overview

Select a form with questions and load it up as a New form or an Edit form by optionally providing data

Class Method Summary collapse

Class Method Details

.for(form_type, form_variant = nil, **data) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/k_starter/questions/ask_questions.rb', line 9

def for(form_type, form_variant = nil, **data)
  return KStarter::Questions::Rails.new(**data)       if form_type == :rails
  return KStarter::Questions::LibraryGem.new(**data)  if form_type == :gem && form_variant == :library
  return KStarter::Questions::CliGem.new(**data)      if form_type == :gem && form_variant == :cli
  return KStarter::Questions::Svelte.new(**data)      if form_type == :svelte

  raise "Unknown form type: #{form_type}"
end