slate 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ require "slate/graph"
5
5
  require "slate/calculation"
6
6
 
7
7
  require "slate/calculation/mean"
8
+ require "slate/calculation/last"
8
9
 
9
10
  module Slate
10
11
  def self.configure
@@ -0,0 +1,9 @@
1
+ module Slate
2
+ module Calculation
3
+ class Last < Base
4
+ def result
5
+ data.last
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Slate
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Slate::Calculation::Last do
4
+ before do
5
+ @graph = Slate::Graph.new(:target => "some.stat")
6
+ data = [
7
+ {
8
+ "target" => "some.stat",
9
+ "datapoints" => [
10
+ [1.0, 1352143990],
11
+ [0.0, 1352144000],
12
+ [2.0, 1352145000],
13
+ [3.0, 1352146000]
14
+ ]
15
+ }
16
+ ]
17
+ @graph.stubs(:download).with(:json).returns(JSON.generate(data))
18
+ end
19
+
20
+ it "should calculate the mean of the series" do
21
+ calculation = Slate::Calculation::Last.new(@graph)
22
+ calculation.result.should == 3.0
23
+ end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-22 00:00:00.000000000 Z
12
+ date: 2012-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -122,12 +122,14 @@ files:
122
122
  - Rakefile
123
123
  - lib/slate.rb
124
124
  - lib/slate/calculation.rb
125
+ - lib/slate/calculation/last.rb
125
126
  - lib/slate/calculation/mean.rb
126
127
  - lib/slate/configuration.rb
127
128
  - lib/slate/graph.rb
128
129
  - lib/slate/target.rb
129
130
  - lib/slate/version.rb
130
131
  - slate.gemspec
132
+ - spec/slate/calculation/last_spec.rb
131
133
  - spec/slate/calculation/mean_spec.rb
132
134
  - spec/slate/graph_spec.rb
133
135
  - spec/slate_spec.rb
@@ -146,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
148
  version: '0'
147
149
  segments:
148
150
  - 0
149
- hash: 2164011891299702634
151
+ hash: 3107282875806844725
150
152
  required_rubygems_version: !ruby/object:Gem::Requirement
151
153
  none: false
152
154
  requirements:
@@ -155,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  version: '0'
156
158
  segments:
157
159
  - 0
158
- hash: 2164011891299702634
160
+ hash: 3107282875806844725
159
161
  requirements: []
160
162
  rubyforge_project:
161
163
  rubygems_version: 1.8.24
@@ -163,6 +165,7 @@ signing_key:
163
165
  specification_version: 3
164
166
  summary: Simple wrapper on top of the graphite render api
165
167
  test_files:
168
+ - spec/slate/calculation/last_spec.rb
166
169
  - spec/slate/calculation/mean_spec.rb
167
170
  - spec/slate/graph_spec.rb
168
171
  - spec/slate_spec.rb