Hi.
What do you think about these changes:
#current_behaviourdef ordinal(number)
abs_number = number.to_i.abs
if (11..13).include?(abs_number % 100)
"th"
else
case abs_number % 10
when 1; "st"
when 2; "nd"
when 3; "rd"
else"th"
end
endend
#new beha
I have found "test_deep_merge_on_indifferent_access". However there is no
test for except method for these cases.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an e
Hi, Jeremy.
It seemed to be a good idea, but then I realized that it is actually not
that good.
Because:
h={'test' => 123, ttt: 1234} # => {"test"=>123, :ttt=>1234}
h=h.with_indifferent_access# => {"test"=>123, "ttt"=>1234}
h.except(:ttt)
Hi all.
What do you think about this changes
https://github.com/rails/rails/compare/master...lvl0nax:am_refactoring?expand=1
Benchmark points
1) gsub => chomp
str = 'some_test'
Benchmark.ips do |x|
x.report("chomp") { str.chomp('_test') }
x.report("gsub") { str.gsub(/_test$/, '') }
x.com
Hi all.
What do you think about this fix: Hash#dup => Hash[hash]
For example:
1) Hash#except method:
class Hash
# current behavior
def except(*keys)
dup.except!(*keys)
end
# new behavior
def except2(*keys)
Hash[self].except!(*keys)
end
def except!(*keys)
keys.ea
Hi all.
I have read activesupport module and found little issue.
class Array
# current behaviour
def split(value = nil)
if block_given?
inject([[]]) do |results, element|
if yield(element)
results << []
else
results.last << element
end
Hi all.
What do you think about little improvements listed below?
before:
{ error: message }.merge(options.except(*CALLBACKS_OPTIONS +
MESSAGE_OPTIONS))
after:
{ error: message }.merge*!*(options.except(*CALLBACKS_OPTIONS +
MESSAGE_OPTIONS))
before:
matchers.map { |method| method.match(m