Skip to content

Instantly share code, notes, and snippets.

@statwonk
Created July 11, 2013 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statwonk/5975418 to your computer and use it in GitHub Desktop.
Save statwonk/5975418 to your computer and use it in GitHub Desktop.
Modularization of monthly statistics scripts.
module MonthlyStats
class MonthTime
def initialize
@begin_time = '2013-06-01'
@end_time = '2013-06-30'
end
def count_code_challenges
puts CodeChallenges.count
end
end
end
mh = MonthlyStats::MonthTime.new
mh.count_code_challenges
@statwonk
Copy link
Author

Command line: RUBY_ENV=data rails runner foo.rb
gives the following:

/home/chris/.rvm/gems/ruby-1.9.3-p327@treehouse/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_
missing': uninitialized constant MonthlyStats::MonthTime::CodeChallenges (NameError)                  
        from db/script/queries/monthly_statistics.rb:9:in `count_code_challenges'                     
        from db/script/queries/monthly_statistics.rb:15:in `<top (required)>'                         

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment