myronmarston-test_benchmarker 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 2
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 1
@@ -1,46 +1,48 @@
1
- class String
2
- # ported from ActiveSupport, so that we don't have to require all of active support for this gem.
3
- # http://github.com/rails/rails/blob/dd2eb1ea7c34eb6496feaf7e42100f37a8dae76b/activesupport/lib/active_support/inflector.rb#L335-376
4
- # Ruby 1.9 introduces an inherit argument for Module#const_get and
5
- # #const_defined? and changes their default behavior.
6
- if Module.method(:const_get).arity == 1
7
- # Tries to find a constant with the name specified in the argument string:
8
- #
9
- # "Module".constantize # => Module
10
- # "Test::Unit".constantize # => Test::Unit
11
- #
12
- # The name is assumed to be the one of a top-level constant, no matter whether
13
- # it starts with "::" or not. No lexical context is taken into account:
14
- #
15
- # C = 'outside'
16
- # module M
17
- # C = 'inside'
18
- # C # => 'inside'
19
- # "C".constantize # => 'outside', same as ::C
20
- # end
21
- #
22
- # NameError is raised when the name is not in CamelCase or the constant is
23
- # unknown.
24
- def constantize
25
- names = self.split('::')
26
- names.shift if names.empty? || names.first.empty?
1
+ unless String.method_defined?(:constantize)
2
+ class String
3
+ # ported from ActiveSupport, so that we don't have to require all of active support for this gem.
4
+ # http://github.com/rails/rails/blob/dd2eb1ea7c34eb6496feaf7e42100f37a8dae76b/activesupport/lib/active_support/inflector.rb#L335-376
5
+ # Ruby 1.9 introduces an inherit argument for Module#const_get and
6
+ # #const_defined? and changes their default behavior.
7
+ if Module.method(:const_get).arity == 1
8
+ # Tries to find a constant with the name specified in the argument string:
9
+ #
10
+ # "Module".constantize # => Module
11
+ # "Test::Unit".constantize # => Test::Unit
12
+ #
13
+ # The name is assumed to be the one of a top-level constant, no matter whether
14
+ # it starts with "::" or not. No lexical context is taken into account:
15
+ #
16
+ # C = 'outside'
17
+ # module M
18
+ # C = 'inside'
19
+ # C # => 'inside'
20
+ # "C".constantize # => 'outside', same as ::C
21
+ # end
22
+ #
23
+ # NameError is raised when the name is not in CamelCase or the constant is
24
+ # unknown.
25
+ def constantize
26
+ names = self.split('::')
27
+ names.shift if names.empty? || names.first.empty?
27
28
 
28
- constant = Object
29
- names.each do |name|
30
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
29
+ constant = Object
30
+ names.each do |name|
31
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
32
+ end
33
+ constant
31
34
  end
32
- constant
33
- end
34
- else
35
- def constantize
36
- names = self.split('::')
37
- names.shift if names.empty? || names.first.empty?
35
+ else
36
+ def constantize
37
+ names = self.split('::')
38
+ names.shift if names.empty? || names.first.empty?
38
39
 
39
- constant = Object
40
- names.each do |name|
41
- constant = constant.const_get(name, false) || constant.const_missing(name)
40
+ constant = Object
41
+ names.each do |name|
42
+ constant = constant.const_get(name, false) || constant.const_missing(name)
43
+ end
44
+ constant
42
45
  end
43
- constant
44
46
  end
45
47
  end
46
48
  end
@@ -18,7 +18,7 @@ if ENV['BENCHMARK_TESTS'] || ENV['TEST_BENCHMARKS_FILE']
18
18
  if @@run_count == 0
19
19
  results = TestBenchmarker::TestBenchmarks.results
20
20
  if ENV['TEST_BENCHMARKS_FILE']
21
- File.open(ENV['TEST_BENCHMARKS_FILE'], 'w') { |f| f << results }
21
+ File.open(ENV['TEST_BENCHMARKS_FILE'], 'a') { |f| f << results }
22
22
  else
23
23
  puts results
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myronmarston-test_benchmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-14 00:00:00 -07:00
12
+ date: 2009-06-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15