1.week和1.weeks之间有区别吗?

时间:2017-06-09 16:52:10

标签: ruby-on-rails

1.week1.weeks之间是否存在差异?或者它们是同义词吗?

3 个答案:

答案 0 :(得分:3)

来自Rails docs

  

week()

     

别名:weeks

           

weeks()

     

返回与提供的周数匹配的Duration实例。

2.weeks # => 2 weeks
     

别名为:week

答案 1 :(得分:2)

对于> 1.week == 1.weeks => true > 42.week == 42.weeks => true

week仅为an alias

答案 2 :(得分:1)

他们是同义词:

Private Sub schedulerControl_DeleteAppointmentFormShowing(sender As Object, e As AppointmentFormEventArgs) Handles schedulerControl.DeleteRecurrentAppointmentFormShowing
    Dim scheduler As DevExpress.XtraScheduler.SchedulerControl = CType(sender, DevExpress.XtraScheduler.SchedulerControl)
    Try
        If koneksiDB.State = ConnectionState.Open Then
            'proses simpan DB
            Dim cmd As New SqlCommand("update Appointments set isdeleted = 1 where UniqueID = @Kode", koneksiDB)
            Dim apt As Appointment = schedulerControl.SelectedAppointments(0)
            Dim dr As DataRowView = CType(apt.GetSourceObject(schedulerStorage), DataRowView)
            Dim id As Integer = Convert.ToInt64(dr("UniqueID"))
            cmd.Parameters.AddWithValue("kode", id)
            cmd.ExecuteNonQuery()
            RefreshDB()
        Else
            MsgBox("Maaf koneksi dengan database terputus. harap memperbaiki koneksi terlebih dahulu.")
        End If
    Catch ex As Exception
        MsgBox("Maaf, terjadi permasalahan teknis :" & Chr(13) & ex.Message & Chr(13) & Chr(13) & "Silakan catat dan hubungi pihak teknisi bila diperlukan.", MsgBoxStyle.Exclamation)
    End Try
End Sub