Permalink
Browse files

app.set with object parameter

improved app.set to handle object parameter.
  • Loading branch information...
1 parent 363d0d4 commit bf6862b8a141f7ef359873d4978d36df8e19bb49 @yhpark committed Sep 16, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/application.js
View
@@ -253,10 +253,15 @@ app.param = function(name, fn){
app.set = function(setting, val){
if (1 == arguments.length) {
- if (this.settings.hasOwnProperty(setting)) {
- return this.settings[setting];
- } else if (this.parent) {
- return this.parent.set(setting);
+ if ('string' == typeof setting) {
+ if (this.settings.hasOwnProperty(setting)) {
+ return this.settings[setting];
+ } else if (this.parent) {
+ return this.parent.set(setting);
+ }
+ } else {
+ utils.merge(this.settings, setting);
+ return this;
}
} else {
this.settings[setting] = val;

0 comments on commit bf6862b

Please sign in to comment.