Yoji Shidara
null+****@clear*****
Thu Feb 27 14:14:05 JST 2014
Yoji Shidara 2014-02-27 14:14:05 +0900 (Thu, 27 Feb 2014) New Revision: 86d5e4c708d0736b6a65ba81f6b84f0a550f4731 https://github.com/droonga/fluent-plugin-droonga/commit/86d5e4c708d0736b6a65ba81f6b84f0a550f4731 Message: Implement Droonga::Dataset#schema Modified files: lib/droonga/catalog/dataset.rb test/unit/catalog/test_dataset.rb Modified: lib/droonga/catalog/dataset.rb (+5 -0) =================================================================== --- lib/droonga/catalog/dataset.rb 2014-02-27 14:03:51 +0900 (e35c8e0) +++ lib/droonga/catalog/dataset.rb 2014-02-27 14:14:05 +0900 (7df32c6) @@ -19,6 +19,7 @@ module Droonga def initialize(name, data) @name = name @data = data + @schema = nil end # provided for compatibility @@ -30,6 +31,10 @@ module Droonga def []=(key, value) @data[key] = value end + + def schema + @schema ||= Droonga::Catalog::Schema.new(@name, @data["schema"]) + end end end end Modified: test/unit/catalog/test_dataset.rb (+11 -0) =================================================================== --- test/unit/catalog/test_dataset.rb 2014-02-27 14:03:51 +0900 (46c048d) +++ test/unit/catalog/test_dataset.rb 2014-02-27 14:14:05 +0900 (dad53c4) @@ -31,5 +31,16 @@ class CatalogDatasetTest < Test::Unit::TestCase )["nWorkers"] ) end + + def test_schema + assert_equal(Droonga::Catalog::Schema.new("dataset_name", {}), + create_dataset("dataset_name", + { + "schema" => { + } + } + ).schema + ) + end end end -------------- next part -------------- HTML����������������������������...Download