Skip to content

Latest commit

 

History

History
30 lines (27 loc) · 846 Bytes

compiler_activesupporttimeext.md

File metadata and controls

30 lines (27 loc) · 846 Bytes

ActiveSupportTimeExt

Tapioca::Dsl::Compilers::ActiveSupportTimeExt generates an RBI file for the Time#current method defined by Active Support's Time extensions.

If Time.zone or config.time_zone are set, then the Time.current method will be defined as returning an instance of ActiveSupport::TimeWithZone, otherwise it will return an instance of Time.

For an application that is configured with:

config.time_zone = "UTC"

this compiler will produce the following RBI file:

class Time
  class << self
    sig { returns(::ActiveSupport::TimeWithZone) }
    def current; end
  end
end

whereas if Time.zone and config.time_zone are not set, it will produce:

class Time
  class << self
    sig { returns(::Time) }
    def current; end
  end
end