Kouhei Sutou
null+****@clear*****
Tue Dec 17 22:46:12 JST 2013
Kouhei Sutou 2013-12-17 22:46:12 +0900 (Tue, 17 Dec 2013) New Revision: e5bb80fd85f2295f614edabbf33867f00d2644d6 https://github.com/droonga/drntest/commit/e5bb80fd85f2295f614edabbf33867f00d2644d6 Message: Extract Directive Added files: lib/drntest/directive.rb Modified files: lib/drntest/test-executor.rb lib/drntest/test-loader.rb Added: lib/drntest/directive.rb (+30 -0) 100644 =================================================================== --- /dev/null +++ lib/drntest/directive.rb 2013-12-17 22:46:12 +0900 (2eefcce) @@ -0,0 +1,30 @@ +# Copyright (C) 2013 Droonga Project +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +module Drntest + class Directive + attr_reader :type, :value + + def initialize(type, value) + @type = normalize_type(type) + @value = value + end + + private + def normalize_type(type) + type.gsub("-", "_").to_sym + end + end +end Modified: lib/drntest/test-executor.rb (+1 -1) =================================================================== --- lib/drntest/test-executor.rb 2013-12-17 22:39:12 +0900 (fb1edfd) +++ lib/drntest/test-executor.rb 2013-12-17 22:46:12 +0900 (bb2776a) @@ -34,7 +34,7 @@ module Drntest port: owner.port) do |client| requests = [] operations.each do |operation| - if operation.is_a?(TestLoader::Directive) + if operation.is_a?(Directive) case operation.type when :enable_logging logging = true Modified: lib/drntest/test-loader.rb (+1 -14) =================================================================== --- lib/drntest/test-loader.rb 2013-12-17 22:39:12 +0900 (33c3d97) +++ lib/drntest/test-loader.rb 2013-12-17 22:46:12 +0900 (7526455) @@ -14,6 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. require "drntest/json-loader" +require "drntest/directive" module Drntest class TestLoader @@ -69,19 +70,5 @@ module Drntest end operations end - - class Directive - attr_reader :type, :value - - def initialize(type, value) - @type = normalize_type(type) - @value = value - end - - private - def normalize_type(type) - type.gsub("-", "_").to_sym - end - end end end -------------- next part -------------- HTML����������������������������...Download