Navigation Menu

Skip to content

Commit

Permalink
Support initializer options correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 27, 2014
1 parent 55f82a1 commit 417333c
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions lib/droonga/catalog_generator.rb
Expand Up @@ -25,27 +25,21 @@ class CatalogGenerator
DEFAULT_TAG = "droonga"

class << self
def new(datasets_params=nil)
generator = super

if datasets_params
datasets_params.each do |name, params|
generator.add_dataset(name, params)
end
end

generator
end

def generate(datasets_params)
new(datasets_params).generate
end
end

def initialize
def initialize(datasets_params=nil)
@version = 2
@effective_date = Time.now
@datasets = {}

if datasets_params
datasets_params.each do |name, params|
add_dataset(name, params)
end
end
end

def add_dataset(name, options)
Expand Down

0 comments on commit 417333c

Please sign in to comment.