class RailsNewApp::AppNameScreen

Public Instance Methods

after_valid() click to toggle source
# File lib/rails-new-app/screens/app_name_screen.rb, line 10
def after_valid
  puts "Your app is: #{@input}\n"
end
next_step() click to toggle source
# File lib/rails-new-app/screens/app_name_screen.rb, line 24
def next_step
  @input != "" ? :menu : :rerender
end
screen_text() click to toggle source
# File lib/rails-new-app/screens/app_name_screen.rb, line 3
def screen_text
  [].tap do |ls|
    ls << "The selected name is invalid." if @error
    ls << "Type the name of the app:"
  end.join("\n")
end
valid?(input) click to toggle source
# File lib/rails-new-app/screens/app_name_screen.rb, line 14
def valid?(input)
  if /\A[a-z_]+\z/i.match?(input.strip)
    @error = false
    true
  else
    @error = true
    false
  end
end