Class: InlineStyles::StableSortingArray

Inherits:
Array
  • Object
show all
Defined in:
lib/inline_styles.rb

Overview

Instance Method Summary collapse

Instance Method Details

#sort_byObject



72
73
74
75
76
# File 'lib/inline_styles.rb', line 72

def sort_by
  n = 0
  c = lambda {|x| n+= 1; [x, n] }
  sort {|a, b| yield(c.call(a), c.call(b)) }
end