Skip to content

Commit

Permalink
Rename Spec to Component.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed May 26, 2017
1 parent 08ac92e commit 04f812c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var debug = require('debug')('electrolyte')
* @constructor
* @param {string} id - The id of the component.
* @param {object} mod - The module containing the component specification.
* @param {number} hs - The handle of the assembly from which the component was loaded.
* @param {number} asm - The assembly from which the component was loaded.
* @protected
*/
function Component(id, mod, asm) {
Expand Down
18 changes: 9 additions & 9 deletions lib/patterns/constructor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Load modules.
var Spec = require('../component')
var Component = require('../component')
, util = require('util')
, debug = require('debug')('electrolyte')
, InvalidArgumentError = require('../errors/invalidargument');
Expand All @@ -13,24 +13,24 @@ var Spec = require('../component')
*
* @constructor
* @param {string} id - The id of the specification.
* @param {object} mod - The module containing the object factory.
* @param {number} hs - The handle of the source from which the spec was loaded.
* @param {object} mod - The module containing the object constructor.
* @param {number} asm - The assembly from which the component was loaded.
* @protected
*/
function ConstructorSpec(id, ctor, hs) {
Spec.call(this, id, ctor, hs);
function ConstructorComponent(id, ctor, hs) {
Component.call(this, id, ctor, hs);
this._ctor = ctor;
}

// Inherit from `Spec`.
util.inherits(ConstructorSpec, Spec);
// Inherit from `Component`.
util.inherits(ConstructorComponent, Component);

/**
* Instantiate an object from the specification.
*
* @private
*/
ConstructorSpec.prototype.instantiate = function() {
ConstructorComponent.prototype.instantiate = function() {
debug('instantiate %s', this.id);
var args = [].slice.call(arguments)
, ctor = this._ctor;
Expand All @@ -52,4 +52,4 @@ ConstructorSpec.prototype.instantiate = function() {


// Expose constructor.
module.exports = ConstructorSpec;
module.exports = ConstructorComponent;
20 changes: 10 additions & 10 deletions lib/patterns/factory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Load modules.
var Spec = require('../component')
var Component = require('../component')
, util = require('util')
, debug = require('debug')('electrolyte');

Expand All @@ -11,25 +11,25 @@ var Spec = require('../component')
* dependencies and returning the result.
*
* @constructor
* @param {string} id - The id of the specification.
* @param {object} mod - The module containing the object factory.
* @param {number} hs - The handle of the source from which the spec was loaded.
* @param {string} id - The id of the component.
* @param {object} fn - The module containing the object factory.
* @param {number} asm - The assembly from which the component was loaded.
* @protected
*/
function FactorySpec(id, fn, hs) {
Spec.call(this, id, fn, hs);
function FactoryComponent(id, fn, asm) {
Component.call(this, id, fn, asm);
this._fn = fn;
}

// Inherit from `Spec`.
util.inherits(FactorySpec, Spec);
// Inherit from `Component`.
util.inherits(FactoryComponent, Component);

/**
* Instantiate an object from the specification.
*
* @private
*/
FactorySpec.prototype.instantiate = function() {
FactoryComponent.prototype.instantiate = function() {
debug('instantiate %s', this.id);

var ctx = {
Expand All @@ -41,4 +41,4 @@ FactorySpec.prototype.instantiate = function() {


// Expose constructor.
module.exports = FactorySpec;
module.exports = FactoryComponent;
18 changes: 9 additions & 9 deletions lib/patterns/literal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Load modules.
var Spec = require('../component')
var Component = require('../component')
, util = require('util');


Expand All @@ -18,19 +18,19 @@ var Spec = require('../component')
* function as a factory.
*
* @constructor
* @param {string} id - The id of the specification.
* @param {object} mod - The module containing the object factory.
* @param {number} hs - The handle of the source from which the spec was loaded.
* @param {string} id - The id of the component.
* @param {object} obj - The module containing the literal object.
* @param {number} asm - The assembly from which the component was loaded.
* @protected
*/
function LiteralSpec(id, obj, hs) {
Spec.call(this, id, obj, hs);
function LiteralComponent(id, obj, asm) {
Component.call(this, id, obj, asm);
this._instance = obj;
}

// Inherit from `Spec`.
util.inherits(LiteralSpec, Spec);
// Inherit from `Component`.
util.inherits(LiteralComponent, Component);


// Expose constructor.
module.exports = LiteralSpec;
module.exports = LiteralComponent;

0 comments on commit 04f812c

Please sign in to comment.