Sha256: 27070cc049a264b644e1ad272fc129d1c4683793fd2b8264fe7517ef6cf22a71

Contents?: true

Size: 654 Bytes

Versions: 9

Compression:

Stored size: 654 Bytes

Contents

module SimpleMetrics
  class Metric

    attr_reader :id, :name, :created_at, :updated_at
    attr_accessor :total

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

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

    def to_s
      attributes.to_s
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
simple_metrics-0.4.6 lib/simple_metrics/metric.rb
simple_metrics-0.4.5 lib/simple_metrics/metric.rb
simple_metrics-0.4.4 lib/simple_metrics/metric.rb
simple_metrics-0.4.3 lib/simple_metrics/metric.rb
simple_metrics-0.4.2 lib/simple_metrics/metric.rb
simple_metrics-0.3.6 lib/simple_metrics/metric.rb
simple_metrics-0.3.5 lib/simple_metrics/metric.rb
simple_metrics-0.3.4 lib/simple_metrics/metric.rb
simple_metrics-0.3.3 lib/simple_metrics/metric.rb