Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple conversion of key=value strings to Hash

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

KV

Build Status

KV is a simple library that parses a string of key=value sets into a Hash.

Installation

Add this line to your application's Gemfile:

gem 'kv'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kv

Usage

require 'kv'

KV.parse('foo=bar a=b')
# => {"foo"=>"bar", "a"=>"b"}

It also handles integers and floats:

KV.parse('a=1 b=2.5123 c=foo')
# => {"a"=>1, "b"=>2.5123, "c"=>"foo"}

To unparse a Hash to a String:

KV.unparse(a: 1)
# => "a=1"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.