I have a module which holds a custom implementation of a Date. Under certain conditions, I need to instantiate a standard Date:
# lib/carbon_date.rb
require 'date'
module CarbonDate
class Date
def initialize(...)
# This constructor is called by some_method()
end
def some_method
standard_date = Date.new(2016, 6, 6) # Calls CarbonDate::Date.new() erroneously
# ...
end
end
end
The method some_method() is calling the constructor of CarbonDate::Date. How to I explicitly scope it to the standard library's Date?