Created
June 9, 2021 01:55
-
-
Save XORwell/1f01e5dfc26537c4d41a7b179feeefc1 to your computer and use it in GitHub Desktop.
rails_monkeypatch.rb
This file contains hidden or 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
class Integer | |
# @example 15778476.to_duration.in_days | |
def to_duration | |
ActiveSupport::Duration.build(self) | |
end | |
end | |
class String | |
# @example "15778476".to_duration | |
def to_duration | |
ActiveSupport::Duration.build(self.to_i) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment