test/insertSQLAction.rb in ppcurses-0.0.20 vs test/insertSQLAction.rb in ppcurses-0.0.21
- old
+ new
@@ -2,36 +2,38 @@
require 'rubygems'
require_relative '../lib/ppcurses.rb'
begin
+ #noinspection RubyResolve
require 'sqlite3'
rescue LoadError => e
abort 'Missing dependency! Run: gem install sqlite3'
end
-stringAction = PPCurses::GetStringAction.new('What is your name? ')
-intAction = PPCurses::GetIntegerAction.new('Input an integer? ')
+string_action = PPCurses::GetStringAction.new('What is your name? ')
+integer_action = PPCurses::GetIntegerAction.new('Input an integer? ')
-def doAction(action)
+def do_action(action)
action.show()
action.execute()
end
-db = SQLite3::Database.open "test.db"
+#noinspection RubyResolve
+db = SQLite3::Database.open 'test.db'
db.execute <<-SQL
create table testTable (name varchar(30), val int);
SQL
-sqlAction = PPCurses::InsertSQLDataAction.new( [stringAction, intAction],
- "Insert into testTable(name, val) values (?, ?)", db)
+sql_action = PPCurses::InsertSQLDataAction.new( [string_action, integer_action],
+ 'Insert into testTable(name, val) values (?, ?)', db)
screen = PPCurses::Screen.new()
-screen.run { doAction(sqlAction) }
+screen.run { doAction(sql_action) }
db.close
-File.delete("test.db")
+File.delete('test.db')