From 9fbbd1e59bd5ce6f6ddbaf82eead65a846da9762 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 24 Sep 2014 12:47:00 -0700 Subject: [PATCH] Back to getSchema --- spec/config-spec.coffee | 8 ++++---- src/config.coffee | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 1e2c14d8b..4d2db8667 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -438,7 +438,7 @@ describe "Config", -> atom.config.setSchema('foo.bar.anInt', schema) expect(atom.config.get("foo.bar.anInt")).toBe 12 - expect(atom.config.schemaForKeyPath('foo.bar.anInt')).toEqual + expect(atom.config.getSchema('foo.bar.anInt')).toEqual type: 'integer' default: 12 @@ -465,7 +465,7 @@ describe "Config", -> type: 'integer' default: 12 - describe '.schemaForKeyPath(keyPath)', -> + describe '.getSchema(keyPath)', -> schema = type: 'object' properties: @@ -475,14 +475,14 @@ describe "Config", -> atom.config.setSchema('foo.bar', schema) - expect(atom.config.schemaForKeyPath('foo.bar')).toEqual + expect(atom.config.getSchema('foo.bar')).toEqual type: 'object' properties: anInt: type: 'integer' default: 12 - expect(atom.config.schemaForKeyPath('foo.bar.anInt')).toEqual + expect(atom.config.getSchema('foo.bar.anInt')).toEqual type: 'integer' default: 12 diff --git a/src/config.coffee b/src/config.coffee index 688074992..8b26ad2f4 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -198,7 +198,7 @@ class Config isDefault: (keyPath) -> not _.valueForKeyPath(@settings, keyPath)? - schemaForKeyPath: (keyPath) -> + getSchema: (keyPath) -> keys = keyPath.split('.') schema = @schema for key in keys @@ -395,7 +395,7 @@ class Config defaults scrubValue: (keyPath, value) -> - value = @constructor.executeSchemaValidators(value, schema) if schema = @schemaForKeyPath(keyPath) + value = @constructor.executeSchemaValidators(value, schema) if schema = @getSchema(keyPath) value Config.addSchemaValidators