Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
calculate the moon phase based on a date
branch: master

This branch is even with chaserx:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
script
spec
tasks
.gitignore
History.txt
Manifest.txt
PostInstall.txt
README.rdoc
Rakefile
moonphase.gemspec

README.rdoc

moonphase

http://github.com/chaserx/moonphase/tree/master

DESCRIPTION:

The moonphase gem provides uses a simple calculation described by HAB on http://www.daniweb.com/code/snippet492.html to calculate the moon phase.

One public method, <tt>getphase(arg)</tt>, takes a single argument that is either a Time or String type. The private method calcphase is invoked and modifies <tt>@phase</tt>

Sections of this code were taken from the following:

* Python code by HAB
* http://www.daniweb.com/code/snippet492.html

and translated into Ruby by Chase Southard on 4/4/2009

FEATURES/PROBLEMS:

  • Calculates the phase of the moon based given a date.

SYNOPSIS:

require 'moonphase'

t = Time.now
moon = Moonphase::Moon.new
moon.getphase(t)

puts moon.phase

or

require 'moonphase'

moon = Moonphase::Moon.new
moon.getphase("4/11")

puts moon.phase

REQUIREMENTS:

  • Ruby 1.8.6 +

  • Ruby 1.9.1 has not been tested.

INSTALL:

sudo gem install moonphase --source=http://gems.github.com

LICENSE:

(The MIT License)

Copyright © 2009 Chase Southard

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.