Navigation Menu

Skip to content

Commit

Permalink
Extract method to validate catalog itself
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Feb 12, 2014
1 parent eb7ecd3 commit 5b38fc9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/droonga/catalog/base.rb
Expand Up @@ -68,10 +68,7 @@ def initialize(data, path)
@path = path
@base_path = File.dirname(path)

validate_effective_date
validate_zones
validate_farms
validate_datasets
validate

@data["datasets"].each do |name, dataset|
number_of_partitions = dataset["number_of_partitions"]
Expand Down Expand Up @@ -189,6 +186,13 @@ def compute_total_weight(dataset)
end
end

def validate
validate_effective_date
validate_zones
validate_farms
validate_datasets
end

def validate_parameter_type(expected, value, name)
unless value.is_a?(expected)
raise MismatchedParameterType.new(name,
Expand Down

0 comments on commit 5b38fc9

Please sign in to comment.