Class: Droonga::CatalogGenerator::Dataset

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/catalog_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Dataset

Returns a new instance of Dataset.



121
122
123
124
# File 'lib/droonga/catalog_generator.rb', line 121

def initialize(name, options)
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



119
120
121
# File 'lib/droonga/catalog_generator.rb', line 119

def name
  @name
end

Instance Method Details

#factObject



138
139
140
# File 'lib/droonga/catalog_generator.rb', line 138

def fact
  @options[:fact]
end

#n_workersObject



126
127
128
# File 'lib/droonga/catalog_generator.rb', line 126

def n_workers
  @options[:n_workers] || DEFAULT_N_WORKERS
end

#pluginsObject



130
131
132
# File 'lib/droonga/catalog_generator.rb', line 130

def plugins
  @options[:plugins] || DEFAULT_PLUGINS
end

#replicasObject



142
143
144
# File 'lib/droonga/catalog_generator.rb', line 142

def replicas
  @replicas ||= create_replicas
end

#schemaObject



134
135
136
# File 'lib/droonga/catalog_generator.rb', line 134

def schema
  @options[:schema] || {}
end

#to_catalogObject



146
147
148
149
150
151
152
153
154
155
# File 'lib/droonga/catalog_generator.rb', line 146

def to_catalog
  catalog = {
    "nWorkers" => n_workers,
    "plugins"  => plugins,
    "schema"   => schema,
    "replicas" => replicas.to_catalog,
  }
  catalog["fact"] = fact if fact
  catalog
end