nightfury 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,13 +17,13 @@ module Nightfury
17
17
  self.to_s.demodulize.underscore
18
18
  end
19
19
 
20
- def metric(name, type = :value)
20
+ def metric(name, type = :value, options={})
21
21
  @metrics ||= {}
22
22
  @metrics[name] = {type: type}
23
-
23
+ store_as = options[:store_as] ? ":#{options[:store_as]}" : 'nil'
24
24
  class_eval <<-ENDOFMETHOD
25
25
  def #{name}
26
- @_#{name} ||= METRIC_MAPPINGS[:#{type}].new(:#{name}, redis_key_prefix: key_prefix)
26
+ @_#{name} ||= METRIC_MAPPINGS[:#{type}].new(:#{name}, redis_key_prefix: key_prefix, store_as: #{store_as})
27
27
  end
28
28
  ENDOFMETHOD
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Nightfury
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -63,12 +63,13 @@ describe Nightfury::Identity::Base do
63
63
 
64
64
  describe "Dynamically generated metric" do
65
65
  it "should instantiate the right metric class" do
66
- Dummy.metric(:third_count)
66
+ Dummy.metric(:third_count, :value, store_as: :t)
67
67
  d = Dummy.new(1)
68
68
  metric_object = d.third_count
69
69
  metric_object.should be_kind_of(Nightfury::Metric::Value)
70
70
  metric_object.name.should == :third_count
71
71
  metric_object.redis_key_prefix.should == 'dummy.1'
72
+ metric_object.store_as.should == :t
72
73
  end
73
74
  end
74
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nightfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: