rrd-ffi 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -9,6 +9,9 @@
9
9
  * TODO: Add memory leak test
10
10
  * TODO: Add tune methods to RRD::Base instance
11
11
 
12
+ == 2010-05-18 version 0.2.3
13
+ * Fixed Bang methods to work with jruby, ruby 1.8.6, ruby 1.9.1
14
+
12
15
  == 2010-03-23 version 0.2.2
13
16
 
14
17
  * Fixed memory leak on RRD::Wrapper (info, graph, last_update, fetch): works on librrd 1.4.2
data/lib/rrd.rb CHANGED
@@ -27,8 +27,12 @@ module RRD
27
27
  used_flags << "--#{flag}".gsub(/_/, "-") if hash.delete(flag)
28
28
  end
29
29
 
30
- line_params = Hash[*hash.reduce([]) { |result, (key,value)| result += ["--#{key}".gsub(/_/, "-"), value.to_s] }]
31
- params = line_params.keys.sort.reduce([]) { |result, key| result += [key, line_params[key]] }
30
+ line_params = []
31
+ hash.each_pair { |key,value| line_params += ["--#{key}".gsub(/_/, "-"), value.to_s] }
32
+ line_params = Hash[*line_params]
33
+
34
+ params = []
35
+ line_params.keys.sort.each { |key| params += [key, line_params[key]] }
32
36
  used_flags + params
33
37
  end
34
38
 
@@ -44,10 +48,12 @@ module RRD
44
48
 
45
49
  # Defining all bang methods
46
50
  BANG_METHODS.each do |bang_method|
47
- define_method(bang_method) do |*args, &block|
48
- method = bang_method.to_s.match(/^(.+)!$/)[1]
49
- bang(method, *args, &block)
50
- end
51
+ class_eval "
52
+ def #{bang_method}(*args, &block)
53
+ method = \"#{bang_method}\".match(/^(.+)!$/)[1]
54
+ bang(method, *args, &block)
55
+ end
56
+ "
51
57
  end
52
58
  end
53
59
 
data/lib/rrd/base.rb CHANGED
@@ -111,10 +111,12 @@ module RRD
111
111
 
112
112
  # Defining all bang methods
113
113
  BANG_METHODS.each do |bang_method|
114
- define_method(bang_method) do |*args, &block|
115
- method = bang_method.to_s.match(/^(.+)!$/)[1]
116
- bang(method, *args, &block)
117
- end
114
+ class_eval "
115
+ def #{bang_method}(*args, &block)
116
+ method = \"#{bang_method}\".match(/^(.+)!$/)[1]
117
+ bang(method, *args, &block)
118
+ end
119
+ "
118
120
  end
119
121
 
120
122
  end
data/lib/rrd/version.rb CHANGED
@@ -2,7 +2,7 @@ module RRD
2
2
  module Version #:nodoc: all
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 2
5
+ PATCH = 3
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/lib/rrd/wrapper.rb CHANGED
@@ -54,7 +54,7 @@ module RRD
54
54
  begin
55
55
  attach_function :rrd_lastupdate_r, [:string, :pointer, :pointer, :pointer, :pointer], :int
56
56
  rescue Exception => e
57
- puts "Please upgrade your rrdtool version to use last_update method"
57
+ warn "Please upgrade your rrdtool version to use last_update method"
58
58
  end
59
59
 
60
60
  attach_function :rrd_resize, [:int, :pointer], :int
@@ -231,7 +231,7 @@ module RRD
231
231
 
232
232
  [["time"] + ds_names, [update_time]+values]
233
233
  ensure
234
- free_pointers
234
+ # free_pointers
235
235
  end
236
236
 
237
237
  # Used to modify the number of rows in an RRA
@@ -291,10 +291,12 @@ module RRD
291
291
 
292
292
  # Defining all bang methods
293
293
  BANG_METHODS.each do |bang_method|
294
- define_method(bang_method) do |*args, &block|
295
- method = bang_method.to_s.match(/^(.+)!$/)[1]
296
- bang(method, *args, &block)
297
- end
294
+ class_eval "
295
+ def #{bang_method}(*args, &block)
296
+ method = \"#{bang_method}\".match(/^(.+)!$/)[1]
297
+ bang(method, *args, &block)
298
+ end
299
+ "
298
300
  end
299
301
 
300
302
  private
data/rrd-ffi.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rrd-ffi}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["morellon", "fnando", "rafaelrosafu", "dalcico"]
12
- s.date = %q{2010-03-23}
12
+ s.date = %q{2010-05-18}
13
13
  s.description = %q{Provides bindings for many RRD functions (using ffi gem and librrd), as well as DSLs for graphic and rrd building. You must have librrd in your system!}
14
14
  s.email = %q{morellon@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrd-ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - morellon
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2010-03-23 00:00:00 -03:00
15
+ date: 2010-05-18 00:00:00 -03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency