rrd-ruby 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/rrd/data.rb +10 -10
  4. data/lib/rrd/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daeb5b5caaff3a57391092455327295daa8c6210
4
- data.tar.gz: 7e97ab2b34253dc454f1a05e943c1116a06f6d98
3
+ metadata.gz: 18d3d1537cfa192372e645ba85428c079abe1bb9
4
+ data.tar.gz: 544a1e6d48ae56645bf8e71e050dd58158dba316
5
5
  SHA512:
6
- metadata.gz: 16614243ebdf97b3b029f3bfb90aa771a80c9229845a428225f103c87d641a705aa6197ea5f91dc74659e834b876ed48bfc97bc35b6730426f5de4ab1647d3cd
7
- data.tar.gz: 48774a58542500e7e4dbd4101a682068c1810af9195abdf06a63f6997278d1dc7f6b7b19fa8da84a6c2254d227ea6d13110ff1f4906f7d697c9ec0e525daf884
6
+ metadata.gz: 9a8f88cda8bc041977a9e124123bc6a0d5e41d9b25a6016f8f3b5b91b47845ab2aa2d9d0ef15b0d8679c85f8493bedb70e1e45a0bddfc1456089b9d8bba6e00d
7
+ data.tar.gz: bc69d45ff5cbfdf6da158919239161c0e06b1c2942d2014a76991050fc3eaa573146fc931e07ee1a079514eec68e74f80bd7fe89947daeb0badc241935124d8a
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  Native ruby implementation of RRD format parsing.
4
4
  Don't need all these pesky C libraries.
5
5
 
6
+ Doesn't include any update functionality, so you still have to use ```rrdtool``` to update your data.
7
+
6
8
  ## Installation
7
9
 
8
10
  Add this line to your application's Gemfile:
@@ -53,4 +55,4 @@ file.close
53
55
  2. Create your feature branch (`git checkout -b my-new-feature`)
54
56
  3. Commit your changes (`git commit -am 'Add some feature'`)
55
57
  4. Push to the branch (`git push origin my-new-feature`)
56
- 5. Create new Pull Request
58
+ 5. Create new Pull Request
data/lib/rrd/data.rb CHANGED
@@ -12,11 +12,19 @@ module RRD
12
12
  header.setup_reader(reader) # update endianess and alignment
13
13
  end
14
14
 
15
+ def first_update
16
+ @start_time = last_update - (rra.rows * step_time)
17
+ end
18
+
15
19
  def last_update
16
20
  @last_update ||= round_time(header.last_update.to_i)
17
21
  end
18
22
 
19
- def last_row
23
+ def step_time
24
+ @step_time ||= header.step * rra.pdpr
25
+ end
26
+
27
+ def fetch_last
20
28
  reader.seek(base_position + rra.current_row * row_size)
21
29
 
22
30
  [last_update] + reader.read(row_size, unpack_formula)
@@ -26,11 +34,7 @@ module RRD
26
34
  row = options[:start_row] || 0
27
35
  rows = [options[:rows] || rra.rows, rra.rows].min
28
36
 
29
- head =
30
-
31
- last_update = round_time(header.last_update.to_i)
32
- current_time = last_update - (rra.rows * step_time)
33
-
37
+ current_time = first_update
34
38
  columns = [:time] + header.datasources.map(&:name).map(&:to_sym)
35
39
 
36
40
  if options[:start_time]
@@ -93,10 +97,6 @@ module RRD
93
97
  @base_position ||= data_start + rra.data_pointer
94
98
  end
95
99
 
96
- def step_time
97
- @step_time ||= header.step * rra.pdpr
98
- end
99
-
100
100
  def row_size
101
101
  @row_size ||= ds_count * 8
102
102
  end
data/lib/rrd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RRD
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrd-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Yamolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler