KITAITI Makoto
null+****@clear*****
Fri Dec 26 13:34:35 JST 2014
KITAITI Makoto 2014-12-26 13:34:35 +0900 (Fri, 26 Dec 2014) New Revision: 07b4de66582663eba8c19fa6eeb63e024c465123 https://github.com/ranguba/epub-searcher/commit/07b4de66582663eba8c19fa6eeb63e024c465123 Message: Extract default database options Modified files: app/app.rb Modified: app/app.rb (+12 -18) =================================================================== --- app/app.rb 2014-12-26 13:32:50 +0900 (5975c75) +++ app/app.rb 2014-12-26 13:34:35 +0900 (75a7fae) @@ -59,12 +59,7 @@ module EPUBSearcher # def search_from_groonga(query_words) - options = { - protocol: :http, - host: settings.droonga_host, - port: settings.droonga_port - } - db = RemoteDatabase.new(options) + db = RemoteDatabase.new(default_db_options) begin db.select( :table => :Books, @@ -78,12 +73,7 @@ module EPUBSearcher end def books_from_groonga - options = { - protocol: :http, - host: settings.droonga_host, - port: settings.droonga_port - } - db = RemoteDatabase.new(options) + db = RemoteDatabase.new(default_db_options) begin db.select( :table => :Books, @@ -95,12 +85,7 @@ module EPUBSearcher end def delete_from_groonga(id) - db_options = { - protocol: :http, - host: settings.droonga_host, - port: settings.droonga_port - } - db = RemoteDatabase.new(db_options) + db = RemoteDatabase.new(default_db_options) begin params = { :table => :Books, @@ -111,6 +96,15 @@ module EPUBSearcher db.close end end + + private + def default_db_options + { + :protocol => :http, + :host => settings.droonga_host, + :port => settings.droonga_port + } + end end end -------------- next part -------------- HTML����������������������������...Descargar