activesupport 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ *1.0.4* (19th April, 2005)
2
+
3
+ * Fixed that in some circumstances controllers outside of modules may have hidden ones inside modules. For example, admin/content might have been hidden by /content. #1075 [Nicholas Seckar]
4
+
5
+ * Fixed inflection of perspectives and similar words #1045 [thijs@vandervossen.net]
6
+
7
+ * Added Fixnum#even? and Fixnum#odd?
8
+
9
+ * Fixed problem with classes being required twice. Object#const_missing now uses require_dependency to load files. It used to use require_or_load which would cause models to be loaded twice, which was not good for validations and other class methods #971 [Nicholas Seckar]
10
+
11
+
1
12
  *1.0.3* (27th March, 2005)
2
13
 
3
14
  * Fixed Inflector.pluralize to handle capitalized words #932 [bitsweat]
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/fixnum/even_odd'
2
+
3
+ class Fixnum #:nodoc:
4
+ include ActiveSupport::CoreExtensions::Fixnum::EvenOdd
5
+ end
@@ -0,0 +1,20 @@
1
+ module ActiveSupport #:nodoc:
2
+ module CoreExtensions #:nodoc:
3
+ module Fixnum #:nodoc:
4
+ # For checking if a fixnum is even or odd.
5
+ # * 1.even? # => false
6
+ # * 1.odd? # => true
7
+ # * 2.even? # => true
8
+ # * 2.odd? # => false
9
+ module EvenOdd
10
+ def even?
11
+ self % 2 == 0
12
+ end
13
+
14
+ def odd?
15
+ !even?
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -10,7 +10,7 @@ module Kernel
10
10
  #
11
11
  # foo # => ['bar', 'baz']
12
12
  #
13
- def returning(value) #:nodoc:
13
+ def returning(value)
14
14
  yield
15
15
  value
16
16
  end
@@ -55,7 +55,7 @@ module Dependencies
55
55
  def self.root(*load_paths)
56
56
  RootLoadingModule.new(*load_paths)
57
57
  end
58
-
58
+
59
59
  def initialize(root, path=[])
60
60
  @path = path.clone.freeze
61
61
  @root = root
@@ -81,9 +81,11 @@ module Dependencies
81
81
  new_module = LoadingModule.new(self.root, self.path + [name])
82
82
  self.const_set name, new_module
83
83
  if self.root?
84
- raise NameError, "Cannot load controller module named #{name}: An object of type #{Object.const_get(name).class.to_s} already exists." \
85
- if Object.const_defined?(name)
86
- Object.const_set(name, new_module)
84
+ if Object.const_defined?(name)
85
+ msg = "Cannot load module #{name}: Object::#{name} is set to #{Object.const_get(name).inspect}"
86
+ raise NameError, msg
87
+ end
88
+ Object.const_set(name, new_module)
87
89
  end
88
90
  break
89
91
  elsif File.file?(fs_path)
@@ -94,7 +96,7 @@ module Dependencies
94
96
  break
95
97
  end
96
98
  end
97
-
99
+
98
100
  return self.const_defined?(name)
99
101
  end
100
102
 
@@ -124,7 +126,7 @@ module Dependencies
124
126
  # Erase all items in this module
125
127
  def clear!
126
128
  constants.each do |name|
127
- Object.send(:remove_const, name) if Object.const_defined?(name)
129
+ Object.send(:remove_const, name) if Object.const_defined?(name) && Object.const_get(name).object_id == self.const_get(name).object_id
128
130
  self.send(:remove_const, name)
129
131
  end
130
132
  end
@@ -175,7 +177,7 @@ class Object #:nodoc:
175
177
  end
176
178
 
177
179
  begin
178
- require_or_load(class_id.to_s.demodulize.underscore)
180
+ require_dependency(class_id.to_s.demodulize.underscore)
179
181
  if Object.const_defined?(class_id) then return Object.const_get(class_id) else raise LoadError end
180
182
  rescue LoadError => e
181
183
  raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e)
@@ -81,6 +81,7 @@ module Inflector
81
81
  [/(s)eries$/i, '\1\2eries'],
82
82
  [/([^aeiouy]|qu)ies$/i, '\1y'],
83
83
  [/([lr])ves$/i, '\1f'],
84
+ [/(tive)s$/i, '\1'],
84
85
  [/([^f])ves$/i, '\1fe'],
85
86
  [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '\1\2sis'],
86
87
  [/([ti])a$/i, '\1um'],
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: activesupport
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.3
7
- date: 2005-03-27
6
+ version: 1.0.4
7
+ date: 2005-04-19
8
8
  summary: Support and utility classes used by the Rails framework.
9
9
  require_paths:
10
10
  - lib
@@ -44,6 +44,8 @@ files:
44
44
  - lib/active_support/values
45
45
  - lib/active_support/core_ext/date
46
46
  - lib/active_support/core_ext/date.rb
47
+ - lib/active_support/core_ext/fixnum
48
+ - lib/active_support/core_ext/fixnum.rb
47
49
  - lib/active_support/core_ext/hash
48
50
  - lib/active_support/core_ext/hash.rb
49
51
  - lib/active_support/core_ext/kernel.rb
@@ -56,6 +58,7 @@ files:
56
58
  - lib/active_support/core_ext/time
57
59
  - lib/active_support/core_ext/time.rb
58
60
  - lib/active_support/core_ext/date/conversions.rb
61
+ - lib/active_support/core_ext/fixnum/even_odd.rb
59
62
  - lib/active_support/core_ext/hash/indifferent_access.rb
60
63
  - lib/active_support/core_ext/hash/keys.rb
61
64
  - lib/active_support/core_ext/numeric/bytes.rb