1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

29 commits

Author SHA1 Message Date
Francesco Rodriguez
d71d5ba71f update AS docs [ci skip] 2012-09-17 00:22:18 -05:00
Francesco Rodriguez
c1c9f1c7b9 fix AS::OrderedOptions documentation [ci skip] 2012-09-17 00:12:11 -05:00
Marc-Andre Lafortune
3ea70f985b Use respond_to_missing? for OrderedOptions 2012-05-05 02:43:41 -04:00
Vishnu Atrai
cd641fa96e ordered_options will work if inherited from Hash, remove OrderedHash usage 2012-02-21 23:08:36 +05:30
Semyon Perepelitsa
bb1813cab8 Replace regexp matching with a simple string manipulation.
Using regexp looks like overkill here and is also 2x slower.

             user     system      total        real
string   0.020000   0.000000   0.020000 (  0.016256)
regexp   0.030000   0.000000   0.030000 (  0.035360)

require "benchmark"

names = ("a".."z").map { |c| c + "a" * rand(5..10) + "=" * rand(0..1) }.map(&:to_sym)
puts names

n = 1000
Benchmark.bmbm do |x|
  x.report "string" do
    n.times do
      names.each do |name|
        string_name = name.to_s
        string_name.chomp!('=')
        string_name
      end
    end
  end

  x.report "regexp" do
    n.times do
      names.each do |name|
        name.to_s =~ /(.*)=$/
        $1
      end
    end
  end
end
2012-01-21 18:32:17 +08:00
Chris Eppstein
266b80c7b2 OrderedOptions must implement respond_to? if it implements method_missing. 2011-06-27 13:44:53 -07:00
Ben Orenstein
67af97c4c1 Fix incorrect example. 2011-03-05 11:56:32 +01:00
Ben Orenstein
726599df98 Remove redundant to_sym call.
[ state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-28 16:43:12 -02:00
thedarkone
5a518487fe Try to use Hash's native #[] for speed. 2010-09-27 17:45:58 +02:00
thedarkone
8cda132136 Make InheritableOptions's constructor more flexible. 2010-09-27 17:45:58 +02:00
thedarkone
918dc27345 Compile ActionController::Base.config's methods to avoid method_missing overhead. 2010-09-27 17:45:58 +02:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Xavier Noria
e0a0638094 commit review: say clearly that AS::OrderedHash is about insertion order, be more neutral in wording, do not imply lack of ordering is a problem 2010-08-06 13:11:44 +02:00
Neeraj Singh
cdbc880055 adding documentation for OrderedHash and OrderedOptions 2010-08-06 01:51:11 -04:00
Carlhuda
6640903481 Move InheritableOptions into ActiveSupport 2010-03-03 15:49:52 -08:00
Jeremy Kemper
7269842080 Explicit dependency on OrderedHash 2009-03-28 23:53:04 -07:00
Joshua Peek
c08547d226 Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [ state:resolved] 2008-06-03 13:32:53 -05:00
Joshua Peek
49846f8586 Create a seperate file for ActiveSupport::OrderedHash. 2008-05-14 12:48:37 -05:00
Sean Ouimet
d75525b045 Added OrderedHash#delete [ state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-05-05 10:03:11 -05:00
Michael Koziarski
42d1172c2d Add OrderedHash#to_hash. Closes [josh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-03 03:31:57 +00:00
Jeremy Kemper
fba05826dc Hash is ordered in Ruby 1.9
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7817 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-09 07:48:59 +00:00
Jeremy Kemper
4dc464c1df Use Array#assoc in ActiveSupport::OrderedHash.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4817 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-25 06:01:02 +00:00
Sam Stephenson
c377ce50ed Add OrderedHash#values
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4411 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-02 17:28:15 +00:00
Jeremy Kemper
d31830cf9c fix test warnings
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4386 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-31 22:43:53 +00:00
Rick Olson
325cb1269c Namespaced OrderedHash so the Rails implementation does not clash with any others. (fixes ) [Julian Tarkhanov]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4318 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-04-30 20:36:37 +00:00
David Heinemeier Hansson
99307b959b Added calculations: Base.count, Base.average, Base.sum, Base.minimum, Base.maxmium, and the generic Base.calculate. All can be used with :group and :having. Calculations and statitics need no longer require custom SQL. [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3646 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-02-25 23:06:04 +00:00
David Heinemeier Hansson
e906ec7f36 Dont include unnecessary active support classes in docs
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-10-16 22:31:55 +00:00
David Heinemeier Hansson
d994b41a05 Added method access to OrdredOptions
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2422 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-09-30 07:14:37 +00:00
David Heinemeier Hansson
9f146ea0ac Added OrderedOptions array/hash for use with initializer
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2419 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-09-30 06:51:42 +00:00