YUKI Piro Hiroshi
null+****@clear*****
Tue Mar 24 23:17:02 JST 2015
YUKI "Piro" Hiroshi 2015-03-24 23:17:02 +0900 (Tue, 24 Mar 2015) New Revision: 11e2302ca1f6e7c60bc2a3426427e15c0ac0b02b https://github.com/droonga/droonga-engine/commit/11e2302ca1f6e7c60bc2a3426427e15c0ac0b02b Message: Addvalidation method for address-like strings Modified files: lib/droonga/address.rb Modified: lib/droonga/address.rb (+9 -0) =================================================================== --- lib/droonga/address.rb 2015-03-24 18:59:56 +0900 (55fc157) +++ lib/droonga/address.rb 2015-03-24 23:17:02 +0900 (eb61b55) @@ -33,6 +33,15 @@ module Droonga raise ArgumentError, message end end + + def valid?(string) + begin + parse(string) + true + rescue ArgumentError + false + end + end end DEFAULT_HOST = Socket.gethostname -------------- next part -------------- HTML����������������������������...Download