Code coverage report for core/src/apm/local/settable.ts

Statements: 88.89% (8 / 9)      Branches: 50% (1 / 2)      Functions: 75% (3 / 4)      Lines: 87.5% (7 / 8)      Ignored: none     

All files » core/src/apm/local/ » settable.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32    1     1       10 10         7                   20 20          
import {Tags} from '../../util';
import {Settable} from '../settable';
import {ReadOnlyValue, Value} from './metric';
 
 
export class LocalSettable<T> implements Settable<T> {
  protected _val: Value<T | undefined>;
 
 
  constructor(readonly name: string, readonly tags: Tags = {}) {
    this._val = new ReadOnlyValue(this.name, undefined, this.tags);
  }
 
 
  get value(): Value<T | undefined> {
    return this._val;
  }
 
 
  get raw(): T | undefined {
    return this.value.value;
  }
 
 
  set(value: T, tags: Tags = {}): Value<T | undefined> {
    this._val = new ReadOnlyValue(this.name, value, {...this.tags, ...tags});
    return this._val;
  }
 
 
}