Skip to content

Commit

Permalink
Add validation for zones
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Feb 12, 2014
1 parent 8560e20 commit 8a5a364
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/droonga/catalog/base.rb
Expand Up @@ -60,6 +60,7 @@ def initialize(data, path)
@path = path
@base_path = File.dirname(path)

validate_zones
validate_farms
validate_datasets

Expand Down Expand Up @@ -209,6 +210,17 @@ def validate_one_or_larger_integer_parameter(value, name)
end
end

def validate_zones
zones = @data["zones"]

raise MissingRequiredParameter.new("zones", @path) unless zones
validate_parameter_type(Array, zones, "zones")

zones.each_with_index do |value, index|
validate_parameter_type(String, value, "zones[#{index}]")
end
end

def validate_farms
farms = @data["farms"]

Expand Down

0 comments on commit 8a5a364

Please sign in to comment.