Created
May 7, 2020 05:38
-
-
Save baweaver/71f1d96cc37270f51c91d87facaad79f 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 DashingRefinement | |
refine Integer do | |
def -(b) "#{self}-#{b}" end | |
end | |
refine String do | |
def -(b) Date.parse("#{self}-#{b}") end | |
end | |
end | |
module Dashingly | |
using DashingRefinement | |
def self.wrap(&fn) instance_eval(&fn) end | |
end | |
# Hrm, that's not quite right either. | |
Dashingly.wrap { 2020-12-11 } | |
=> 1997 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment