Sha256: 0d11570984c7a0b850ab0ccd176fac5e69be8b8c1deca7a60f7d296fb1709caf
Contents?: true
Size: 1.95 KB
Versions: 4
Compression:
Stored size: 1.95 KB
Contents
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA module Groonga class Client class Searcher class Schema attr_reader :table attr_reader :columns def initialize(table) @table = table @columns = {} end def table=(name) name = name.to_s if name.is_a?(Symbol) @table = name end def column(name, options) name = normalize_name(name) @columns[name] = Column.new(name, options) end def have_column?(name) name = normalize_name(name) @columns.key?(name) end private def normalize_name(name) if name.is_a?(Symbol) name.to_s else name end end class Column attr_reader :name def initialize(name, options) @name = name @options = options end def type @options[:type] || "Text" end def have_index? @options[:index] end def have_full_text_search_index? have_index? and @options[:index_type] == :full_text_search end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems