def build_singleton_methods
      method =
        case @age
        when 'daily'
          -> {
            now = Time.now
            (now.day != age_fn_mtime.day) || (now - age_fn_mtime) > 86400
          }

        when 'weekly'
          -> { (Time.now - age_fn_mtime) > 604800 }

        when 'monthly'
          -> {
            now = Time.now
            (now.month != age_fn_mtime.month) || (now - age_fn_mtime) > 2678400
          }

        when Integer, String
          @age = Integer(@age)
          -> { (Time.now - age_fn_mtime) > @age }

        else
          -> { false }
        end

      self.define_singleton_method(:sufficiently_aged?, method)
    end
def build_singleton_methods
      method =
        case @age
        when 'daily'
          -> {
            now = Time.now
            (now.day != age_fn_mtime.day) || (now - age_fn_mtime) > 86400
          }

        when 'weekly'
          -> { (Time.now - age_fn_mtime) > 604800 }

        when 'monthly'
          -> {
            now = Time.now
            (now.month != age_fn_mtime.month) || (now - age_fn_mtime) > 2678400
          }

        when Integer, String
          @age = Integer(@age)
          -> { (Time.now - age_fn_mtime) > @age }

        else
          -> { false }
        end

      self.define_singleton_method(:sufficiently_aged?, method)
    end
We use meta-programming here to define the `sufficiently_aged?` method for
 the rolling appender. The `sufficiently_aged?` method is responsible for
 determining if the current log file is older than the rolling criteria -
 daily, weekly, etc.

 Returns this rolling file appender instance