params_parser 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65ac4c5d0c8151362a66c68801d1403568dc4454
4
- data.tar.gz: 845fb07403644501b4eda3ead29c93de9f4411ae
3
+ metadata.gz: 9eb4ae51a6a24883fc83cca6cc81483fb531bfbf
4
+ data.tar.gz: c05f3cc5c711990fb3f0d6ecce1461c2a51465e1
5
5
  SHA512:
6
- metadata.gz: 95c3a116219fabe8632d6b4c20b22977d8a421a2dd1b5201f2614d4f9b6a3b795a6407de6bad15de8e0c70e0e783d2c87b5cc562d75420ebfeae98cd4f10e3d5
7
- data.tar.gz: a6180598c5705f28078f15a4cd360010f538f0edba0254b9d55e11be1b1a97756ad8175a784ac23628bb8531a49b11ad0f3f17ff289cdb223fe79f85dee6268f
6
+ metadata.gz: f4d7d9f6369aff44e1491860240b03c8315bc580af12b08bce6c26f96a1302c2f37458b01c59fed7da94dcd975aa63e53174c2e9cd9611664e8362d8420b2384
7
+ data.tar.gz: 1f0d06dfd1a815a00fc5ae61feefd6730086e5e56cabe252f5b31860d15de8ea85f70ca51841cfe3be25adb0a978a1fc47efe00faabeb679e6945bfc8d8080f3
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - rbx-2
7
+ - ruby-head
data/README.md CHANGED
@@ -1,6 +1,15 @@
1
+ [![Build Status](https://travis-ci.org/gustly/params_parser.svg?branch=master)](https://travis-ci.org/gustly/params_parser)
2
+
1
3
  # ParamsParser
2
4
 
3
- TODO: Write a gem description
5
+ `ParamsParser` is a simple gem to help - you guessed it - parse parameter hashes.
6
+
7
+ `ParamsParser` currently supports:
8
+
9
+ * defaults
10
+ * transformations
11
+ * mapping input keys to output keys
12
+
4
13
 
5
14
  ## Installation
6
15
 
@@ -18,7 +27,30 @@ Or install it yourself as:
18
27
 
19
28
  ## Usage
20
29
 
21
- TODO: Write usage instructions here
30
+ Create a parser with a configuration hash:
31
+
32
+ ```ruby
33
+ parser = ParamsParser::Parser.new({
34
+ id: { transform: Model.public_method(:find), map_to: :model }
35
+ page: { default: 1, transform: :to_i.to_proc }
36
+ })
37
+ ```
38
+
39
+ Parse parameters:
40
+
41
+ ```ruby
42
+ parser.parse({ # {
43
+ id: "1", # model: Model(...),
44
+ page: "5" # page: 5
45
+ }) # }
46
+ ```
47
+
48
+ ```ruby
49
+ parser.parse({ # {
50
+ id: "1", # model: Model(...),
51
+ }) # page: 1
52
+ # }
53
+ ```
22
54
 
23
55
  ## Contributing
24
56
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,3 +1,3 @@
1
1
  module ParamsParser
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "params_parser"
8
8
  spec.version = ParamsParser::VERSION
9
9
  spec.authors = ["Peter Swan", "Todd Mohney"]
10
- spec.email = ["pdswan@gmail.com", "todd@gust.com"]
10
+ spec.email = ["pdswan@gmail.com", "toddmohney@gmail.com"]
11
11
  spec.summary = %q{Parse Parameters with key mapping, transformation, and defaults.}
12
12
  spec.description = %q{Parse Parameters with key mapping, transformation, and defaults.}
13
13
  spec.homepage = "https://github.com/gustly/params_parser"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: params_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Swan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-22 00:00:00.000000000 Z
12
+ date: 2014-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -56,12 +56,14 @@ dependencies:
56
56
  description: Parse Parameters with key mapping, transformation, and defaults.
57
57
  email:
58
58
  - pdswan@gmail.com
59
- - todd@gust.com
59
+ - toddmohney@gmail.com
60
60
  executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
64
  - .gitignore
65
+ - .rspec
66
+ - .travis.yml
65
67
  - Gemfile
66
68
  - LICENSE.txt
67
69
  - README.md