Module: Darian

Defined in:
lib/darian/date.rb,
lib/darian.rb,
lib/darian/time.rb,
lib/darian/version.rb,
lib/darian/date_methods.rb

Overview

Darian Mars calendar time converter.

Copyright © 2012 Andrey “A.I.” Sitnik <[email protected]>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Modules: DateMethods Classes: Date, Time

Constant Summary collapse

VERSION =
'0.0.2'.freeze

Class Method Summary collapse

Class Method Details

.from_earth(arg) ⇒ Object

Convert ‘arg` to martian time or date, depend on `arg` class.



31
32
33
34
35
36
37
38
39
# File 'lib/darian.rb', line 31

def from_earth(arg)
  if arg.is_a? ::Time
    Darian::Time.from_earth(arg)
  elsif arg.is_a? ::Date
    Darian::Date.from_earth(arg)
  else
    raise ArgumentError, "Can't convert #{arg.class} to martian time or date"
  end
end