Sha256: 92117c3ed3de14388c4b691f4bc93fc51933dea517a130d469d636829300711c

Contents?: true

Size: 380 Bytes

Versions: 7

Compression:

Stored size: 380 Bytes

Contents

class DistanceCollection < Array
  def set_distance_from(origin, opts={})
    distance_attribute_name = opts.delete(:distance_attribute_name) || 'distance'
    klass = first.class
    klass.send(:attr_accessor, distance_attribute_name) if !klass.respond_to?("#{distance_attribute_name}=")
    each{|e| e.send("#{distance_attribute_name}=", e.distance_to(origin,opts)) }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
geokit-rails-2.5.0 lib/geokit-rails/distance_collection.rb
geokit-rails-2.3.2 lib/geokit-rails/core_extensions.rb
geokit-rails-2.3.1 lib/geokit-rails/core_extensions.rb
geokit-rails-2.3.0 lib/geokit-rails/core_extensions.rb
geokit-rails-2.2.0 lib/geokit-rails/core_extensions.rb
geokit-rails-2.1.0 lib/geokit-rails/core_extensions.rb
geokit-rails-2.0.1 lib/geokit-rails/core_extensions.rb