New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

porth-kml

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

porth-kml

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

porth-kml (Plain Old Ruby Template Handler - KML output)

Adds KML (.kml) support to 'porth' (Plain Old Ruby Template Handler) gem.

This allows a view written in plain ruby to create a tree of kml objects using the ruby_kml gem and have that kml be rendered to the browser.

Requirements

Installation

Add this to your project's Gemfile and run $ bundle install

gem 'porth-kml'

Usage

Add the ".kml" mime time to your rails app's config/initializers/mime_types.rb:

Mime::Type.register "application/vnd.google-earth.kml+xml", :kml

Add ":kml" to your controller's responds_to calls, for example:

class PeopleController < ApplicationController

  respond_to :json, :xml, :kml, :html

  # GET /people
  # GET /people.json
  def index
    @people = Person.all

    respond_with @people
  end

  # GET /people/1
  # GET /people/1.json
  def show
    @person = Person.find(params[:id])

    respond_with @person
  end

Then your view must return a KMLFile object, for example:

require 'ruby_kml'

kml = KMLFile.new
folder= KML::Folder.new(:name => 'People')

@person.each do |person|
  point = KML::Point.new :coordinates => { :lat => person.latitude,
                                           :lng => person.longitude }
  place = KML::Placemark.new :geometry => point, :name => person.name
  folder.features << place
end

kml.objects << folder
kml

etc...

Dependencies

Runtime dependencies:

  • porth
  • ruby_kml
  • action_pack (>= 3.1) (to be consistent with porth)
  • active_record (>= 3.1) (to be consistent with above)

Development dependencies:

  • rpsec
  • rake

Compatibility

  • MRI 1.9.2+

  • rails >= 3.1 (to be consistent with Porth)

Contributing

  1. Fork
  2. Install dependancies by running $ bundle install
  3. Write tests and code
  4. Make sure the tests pass by running $ rake test
  5. Push and send a pull request on GitHub

Credits

Special thanks to Tate Johnson (et al) for making Porth!

Copyright © 2012 Matt Connolly. Released under the MIT license. See LICENSE.

FAQs

Package last updated on 11 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc