Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # for some reason the closure doesn't have access to class variables
- lon = params[:x]; lat = params[:y]; zoom = params[:zoom]; city = current_quest.city.code;
- width = params[:width].to_f; height = params[:height].to_f
- current_quest.primary_window = GeoLocation.new do
- # self.lon = params[:x]; self.lat = params[:y]; self.zoom = params[:zoom]
- puts "width: #{width}"
- puts "lat: #{lat}"
- self.lon = lon; self.lat = lat;
- self.width = width; self.height = height;
- self.zoom = zoom; self.city = city
- end
- puts "LAT: #{current_quest.primary_window.lat}"
- puts "WIDTH: #{current_quest.primary_window.width}"
- current_quest.save unless current_quest.anonymous?
- class GeoLocation
- attr_accessor :lon, :lat, :width, :height, :zoom, :zip, :city, :state, :zip,
- :precision, :dist_from_home, :string_as_geocoded, :geo_postal, :geo_street_address, :geo_city, :geo_state
- def initialize(&block)
- instance_eval(&block)
- end
- ...
- end
- Output:
- width: 0.316406250000023
- lat: 37.754972691904946
- LAT: 37.754972691904946
- WIDTH:
Add Comment
Please, Sign In to add comment