Sha256: 85b29842bf08df705f3664c80a783984da8d91f4c606f3a5c2755fae85e4e22f

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

module SimpleMetrics
  class Instrument

    attr_accessor :id, :name, :metrics, :created_at, :updated_at

    def initialize(attributes)
      @id          = attributes[:id]
      @name        = attributes[:name]
      @created_at  = attributes[:created_at]
      @updated_at  = attributes[:updated_at]
      @metrics     = attributes[:metrics] || []
    end

    def attributes
      { 
        :id          => @id.to_s, # convert bson id to str
        :name        => @name,
        :metrics     => @metrics,
        :created_at  => @created_at,
        :updated_at  => @updated_at
      }
    end

    def to_s
      attributes.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_metrics-0.4.2 lib/simple_metrics/instrument.rb