Module: Earth::InsolationScopes

Included in:
DirectNormalInsolation, GlobalHorizontalInsolation, PhotovoltaicInsolation
Defined in:
lib/earth/insolation_scopes.rb

Class Method Summary collapse

Class Method Details

.included(target) ⇒ Object



3
4
5
6
7
8
# File 'lib/earth/insolation_scopes.rb', line 3

def self.included(target)
  target.scope :at_lat_lon, lambda { |lat, lon|
    target.where('nw_lat > ? AND nw_lon > ? AND se_lat < ? AND se_lon < ?', lat, lon, lat, lon)
  }
  target.scope :at_zip, lambda { |zip| target.at_lat_lon(zip.latitude, zip.longitude) }
end