Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove autoload
  • Loading branch information
erithmetic committed Dec 29, 2011
1 parent b2f195b commit 40230b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/carbon.rb
Expand Up @@ -15,6 +15,10 @@

require 'logger'

require 'carbon/base'
require 'carbon/emission_estimate'
require 'carbon/registry'

# A module (aka mixin) that lets you estimate carbon emissions by querying the {Brighter Planet carbon middleware emission estimate web service}[http://carbon.brighterplanet.com].
#
# class RentalCar
Expand All @@ -35,10 +39,6 @@
#
# Once you've mixed in <tt>Carbon</tt>, you get the method <tt>emission_estimate</tt>, which you can call at any time to request an emission estimate.
module Carbon
autoload :Base, 'carbon/base'
autoload :EmissionEstimate, 'carbon/emission_estimate'
autoload :Registry, 'carbon/registry'

def self.included(klass) # :nodoc:
klass.extend ClassMethods
end
Expand Down
10 changes: 5 additions & 5 deletions lib/carbon/emission_estimate.rb
@@ -1,3 +1,7 @@
require 'carbon/emission_estimate/response'
require 'carbon/emission_estimate/request'
require 'carbon/emission_estimate/storage'

module Carbon
# Let's start off by saying that realtime <tt>EmissionEstimate</tt> objects quack like numbers.
#
Expand All @@ -7,12 +11,8 @@ module Carbon
#
# At the same time, they contain all the data you get back from the emission estimate web service. For example, you could say <tt>puts my_donut_factor.emission_estimate.oven_count</tt> (see the tests) and you'd get back the oven count used in the calculation, if any.
class EmissionEstimate
autoload :Response, 'carbon/emission_estimate/response'
autoload :Request, 'carbon/emission_estimate/request'
autoload :Storage, 'carbon/emission_estimate/storage'

def self.parse(str) #:nodoc:
data = ::ActiveSupport::JSON.decode str
data = ActiveSupport::JSON.decode str
if data.has_key? 'active_subtimeframe'
interval = "#{data['active_subtimeframe']['startDate']}/#{data['active_subtimeframe']['endDate']}"
data['active_subtimeframe'] = Timeframe.interval(interval)
Expand Down

0 comments on commit 40230b4

Please sign in to comment.