Skip to content

Commit

Permalink
Add String resource class
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jan 14, 2016
1 parent 2de3f69 commit d9d1cbf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/common/res.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Resource {
return yaml.safeLoad(data)
}

static async open(name) {
return new this(this.parse(await read(this.expand(name))))
static async open(name, ...args) {
return new this(this.parse(await read(this.expand(name))), ...args)
}

static expand(name) {
Expand All @@ -42,7 +42,14 @@ class Menu extends Resource {
}
}

class Strings extends Resource {
static get base() { return join(super.base, 'strings') }

constructor(data = {}, locale = 'en') {
this.data = data[locale]
}
}

module.exports = {
Resource,
Menu
Resource, Menu, Strings
}

0 comments on commit d9d1cbf

Please sign in to comment.