Update for Membership to work in Ruby 1.9.2
- note #!/usr/local/ruby19/bin/ruby -w
- is the path to my install of ruby 1.9, if you have ruby 1.9.2 installed in a different location, just update this to be #!/usr/bin/ruby or the path to your ruby install location.
Loading branch information
1 changed file
and 7 deletions.
@@ -1,13 +1,15 @@
#!/usr/ bin/ruby -w
#!/usr/ local/ruby19/binruby -w
# = Membership System
# Check to see if a Membership is expired
require 'rubygems ' #note. Ruby 1.9 includes rubygems by default, so this is not nessesary
#require 'rubygems' #note. Ruby 1.9 includes rubygems by default, so this is not nessesary
require 'rubygems '
require 'hashie '
require 'time '
# parsedate will take a String and return a Time object
require 'parsedate '
@@ -28,8 +30,10 @@ def am_i_good?(user = nil)
# Convert the Users last payment to a Time object from String
= Time.local( *parsedate(last_real_payment))
# Time.parse replaces parsedate in 1.9+
# last_payment_as_time = Time.local(*parsedate(last_real_payment)) #1.8.7 syntax
#parse the date string and compare the current Time against the last payment made by the User
# if the users payment datetime plus the (subscription period) is greater than or equal to the current datetime
@@ -90,7 +94,7 @@ def super_class_subscription_period
#user.membership.payment_date = "Fri May 05 21:06:22 -0700 2010"
# Create a new Membership Object
= Membership. new(user, 60)
= Membership. new(user, 30)
# Reference a Class from within another Class