kametori 0.0.1a → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kametori/version.rb +1 -1
- data/lib/kametori.rb +1 -33
- metadata +4 -4
data/lib/kametori/version.rb
CHANGED
data/lib/kametori.rb
CHANGED
@@ -1,37 +1,5 @@
|
|
1
1
|
require "kametori/version"
|
2
2
|
|
3
3
|
module Kametori
|
4
|
-
#
|
5
|
-
class Error < RuntimeError
|
6
|
-
end
|
7
|
-
class Timeout < RuntimeError
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def limits=(limits)
|
13
|
-
raise Error if !limits.is_a? Array
|
14
|
-
@limits = limits
|
15
|
-
end
|
16
|
-
|
17
|
-
def limits
|
18
|
-
@limits
|
19
|
-
end
|
20
|
-
|
21
|
-
def benchmark_scenario(scenario, options={})
|
22
|
-
under_test = @limits.find{ |limit| limit[:tag] == scenario.tag}
|
23
|
-
return nil if under_test.nil?
|
24
|
-
before = Time.now
|
25
|
-
yield if block_given?
|
26
|
-
after = Time.now
|
27
|
-
elapsed = after - before
|
28
|
-
if options[:raise]
|
29
|
-
if ( elapsed > under_test[:limit])
|
30
|
-
raise Timeout
|
31
|
-
end
|
32
|
-
end
|
33
|
-
elapsed
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
4
|
+
# Your code goes here...
|
37
5
|
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kametori
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jordi Polo Carres
|
@@ -58,9 +58,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
none: false
|
60
60
|
requirements:
|
61
|
-
- - ! '
|
61
|
+
- - ! '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
66
|
rubygems_version: 1.8.24
|