Kouhei Sutou
null+****@clear*****
Wed Jun 19 17:09:27 JST 2013
Kouhei Sutou 2013-06-19 17:09:27 +0900 (Wed, 19 Jun 2013) New Revision: 38a27e704f7f674a4b64fd3e75495a0640a076fd https://github.com/groonga/fluent-plugin-droonga/commit/38a27e704f7f674a4b64fd3e75495a0640a076fd Message: Extract common code that gets record value Modified files: lib/droonga/plugin/handler_search.rb Modified: lib/droonga/plugin/handler_search.rb (+6 -2) =================================================================== --- lib/droonga/plugin/handler_search.rb 2013-06-19 17:03:13 +0900 (08e9ae9) +++ lib/droonga/plugin/handler_search.rb 2013-06-19 17:09:27 +0900 (bddbb17) @@ -262,17 +262,21 @@ module Droonga def complex_record(attributes, record) values = {} attributes.collect do |attribute| - values[attribute[:label]] = attribute[:static_value] || record[attribute[:source]] + values[attribute[:label]] = record_value(record, attribute) end values end def simple_record(attributes, record) attributes.collect do |attribute| - attribute[:static_value] || record[attribute[:source]] + record_value(record, attribute) end end + def record_value(record, attribute) + attribute[:static_value] || record[attribute[:source]] + end + STATIC_INTEGER_VALUE_PATTERN = /\A[-+]?\d+\z/.freeze STATIC_FLOAT_VALUE_PATTERN = /\A[-+]?\d*\.\d+\z/.freeze STATIC_STRING_VALUE_PATTERN = /\A("[^"]*"|'[^']*')\z/.freeze -------------- next part -------------- HTML����������������������������... 다운로드