Class XMLRPC::DateTime
In: xmlrpc/datetime.rb
Parent: Object

Methods

==   day=   hour=   min=   mon=   month=   new   sec=   to_a   to_date   to_time   year=  

External Aliases

month -> mon

Attributes

day  [R] 
hour  [R] 
min  [R] 
month  [R] 
sec  [R] 
year  [R] 

Public Class methods

[Source]

# File xmlrpc/datetime.rb, line 108
  def initialize(year, month, day, hour, min, sec)
    self.year, self.month, self.day = year, month, day
    self.hour, self.min, self.sec   = hour, min, sec
  end

Public Instance methods

[Source]

# File xmlrpc/datetime.rb, line 129
  def ==(o)
    Array(self) == Array(o)
  end

[Source]

# File xmlrpc/datetime.rb, line 84
  def day= (value)
    raise ArgumentError, "date/time out of range" unless (1..31).include? value
    @day = value
  end

[Source]

# File xmlrpc/datetime.rb, line 89
  def hour= (value)
    raise ArgumentError, "date/time out of range" unless (0..24).include? value
    @hour = value
  end

[Source]

# File xmlrpc/datetime.rb, line 94
  def min= (value)
    raise ArgumentError, "date/time out of range" unless (0..59).include? value
    @min = value
  end
mon=(value)

Alias for month=

[Source]

# File xmlrpc/datetime.rb, line 79
  def month= (value)
    raise ArgumentError, "date/time out of range" unless (1..12).include? value
    @month = value
  end

[Source]

# File xmlrpc/datetime.rb, line 99
  def sec= (value)
    raise ArgumentError, "date/time out of range" unless (0..59).include? value
    @sec = value
  end

[Source]

# File xmlrpc/datetime.rb, line 125
  def to_a
    [@year, @month, @day, @hour, @min, @sec]
  end

[Source]

# File xmlrpc/datetime.rb, line 121
  def to_date
    Date.new(*to_a[0,3])
  end

[Source]

# File xmlrpc/datetime.rb, line 113
  def to_time
    if @year >= 1970
      Time.gm(*to_a)
    else
      nil
    end
  end

[Source]

# File xmlrpc/datetime.rb, line 74
  def year= (value)
    raise ArgumentError, "date/time out of range" unless value.is_a? Integer
    @year = value
  end

[Validate]