Sha256: 8e1fcb1910b210fb021f2f94965f07f0e707b3302b8770c7cc4b92a2be8974b2

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

# Divining Rod

A tool to help format your sites mobile pages. The goal is to have the ability to do things in your
views like this

    <%- if request.dv_profile.youtube_capable? %>
      <%= link_to "YouTube Video", @link.youtube_url %>
    <%- else %>
      Sorry, you have a shitty phone.
    <% end %>

## Installation

    gem install divining_rod
    
## Usage

    require 'divining_rod'

    DiviningRod::Matchers.define do |map|
        map.ua /iPhone/, :webkit, :tags => [:iphone, :youtube_capable]
        map.ua /Android/, :webkit, :tags => [:youtube_capable, :google_gears]
        map.default :unknown
    end
    
    profile = DiviningRod::Profile(request) #profile and incoming iphone request
    profile.format #=> :webkit
    profile.iphone? #=> true
    
## Note on the development

This is still very much in beta, but we are using in extensively in production. We plan
to keep the API the same.

The user agent definitions will be updated here later this week.


### Note on Patches/Pull Requests
 
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
  future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.

### Copyright

Copyright (c) 2010 Mark Percival. See LICENSE for details.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
divining_rod-0.2.0 README.markdown
divining_rod-0.1.1 README.markdown