Class: Droonga::Catalog::Generator::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.



122
123
124
125
# File 'lib/droonga/catalog/generator.rb', line 122

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



120
121
122
# File 'lib/droonga/catalog/generator.rb', line 120

def name
  @name
end

Instance Method Details

#factObject



139
140
141
# File 'lib/droonga/catalog/generator.rb', line 139

def fact
  @options[:fact]
end

#n_workersObject



127
128
129
# File 'lib/droonga/catalog/generator.rb', line 127

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

#pluginsObject



131
132
133
# File 'lib/droonga/catalog/generator.rb', line 131

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

#replicasObject



143
144
145
# File 'lib/droonga/catalog/generator.rb', line 143

def replicas
  @replicas ||= create_replicas
end

#schemaObject



135
136
137
# File 'lib/droonga/catalog/generator.rb', line 135

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

#to_catalogObject



147
148
149
150
151
152
153
154
155
156
# File 'lib/droonga/catalog/generator.rb', line 147

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