Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/activefacts/api/numeric.rb

Overview

A Date can be constructed from any Date subclass, not just using the normal date constructors.

Direct Known Subclasses

ActiveFacts::Metamodel::Date

Class Method Summary collapse

Class Method Details

.new(*a, &b) ⇒ Object

Date.new cannot normally be called passing a Date as the parameter. This allows that.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/activefacts/api/numeric.rb', line 72

def self.new(*a, &b)
  #puts "Constructing date with #{a.inspect} from #{caller*"\n\t"}"
  if (a.size == 1 && a[0].is_a?(Date))
    a = a[0]
    civil(a.year, a.month, a.day, a.start)
  elsif (a.size == 1 && a[0].is_a?(String))
    parse(a[0])
  else
    civil(*a, &b)
  end
end

.old_newObject



70
# File 'lib/activefacts/api/numeric.rb', line 70

alias_method :old_new, :new