class Gambiarra::UI::CreateView

Public Instance Methods

render() click to toggle source
# File lib/gambiarra/ui/views/create_view.rb, line 8
      def render
        view = params[:view_name].gsub(/ |_|-/, '_').downcase
        thor.create_file("lib/#{project_name}/ui/views/#{view}.rb", <<~RUBY)
          module #{project_constant}
            module UI
              # you can also inherit from your other views, questions will be merged
              # assign them to nil to erase them
              class #{view.camelize} < BaseView
                questions({
                  question_name: {
                    statement: 'Welcome to #{project_name.titleize}',
                    options: ['exit'] # delete options to make this free form
                  }
                })
              end

              def render
                # might want render something here after questions are answered
              end
            end
          end

        RUBY
      end