-
-
Save radar/2c06a80f10cd5d0ffc4759fcf5c210c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JSSort | |
def self.included(base) | |
base.alias_method :old_sort, :sort | |
end | |
def sort | |
if first.is_a?(Numeric) | |
self.map(&:to_s).old_sort.map(&:to_i) | |
else | |
self.old_sort | |
end | |
end | |
end | |
Array.include(JSSort) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment