whoopee-cushion 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccc95428b5dc5b3bd5d1ed724eab8fff67072006
4
- data.tar.gz: 7ca139a81753a6c12336ed13b7619d97db4a667d
3
+ metadata.gz: 6ada589c5e9a9f9ff5bca6dbed49f5e8f217bb47
4
+ data.tar.gz: 80775f1deabb6de9a20c62c2030e12c12ea86921
5
5
  SHA512:
6
- metadata.gz: c5ad18495ba334ab02ea35604191154533cc4bf625e6908eacaf85776fc03a40368572172288718959c567ce2d4ad998b4a496b94c57c139363084c87b75fd5b
7
- data.tar.gz: 131aa58433d4280588ffc140844d1d460f981455bdc653a64a9e4d23691e6dbf121de03149dca16a46e58f22f71c40f985293aa4ce919f8fb02f5439058db9b7
6
+ metadata.gz: e41b72652029b3f0268331977f4f7fa21f27e51163d7246dfa46bbcbc00293378d9f46675d3d522316566f07a5e65e98b46250be230f833a974acc85130117b9
7
+ data.tar.gz: 96694182f4b57a80e7bae615b5ebb23e098e3633d3dada28b0dce765259c5c459fef9c2acfabaf64f4eabd2a4a47d40ae3e185f9849626d1c6bec127e68be2ef
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- gem 'byebug'
3
- gem 'recursive-open-struct'
4
2
  # Specify your gem's dependencies in whoopee_cushion.gemspec
5
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whoopee-cushion (0.0.1)
4
+ whoopee-cushion (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -12,4 +12,40 @@ Wouldn't it be nice if you could access all your API response data like this?
12
12
 
13
13
  `obj.products.first.customer.customer_id`
14
14
 
15
- whoopee-cushion will let you do just that. It's a fast and
15
+ whoopee-cushion will let you do just that. It's faster than using OpenStructs or any recursive algorithms based on them
16
+ because it uses Ruby's faster Struct objects under the hood.
17
+
18
+ Setup
19
+ =====
20
+
21
+ `gem install whoopee-cushion`
22
+
23
+ or
24
+
25
+ `gem "whoopee-cushion"`
26
+
27
+ in your Gemfile.
28
+
29
+ In your Ruby code:
30
+
31
+ `require 'whoopee_cushion'`
32
+
33
+ then
34
+
35
+ `hash = {:a => 1, :CamelCase => 2, :c => 3, :d => { :e => 4, :f => [1,2,3,4,5]}}`
36
+
37
+ `obj = WhoopeeCushion::Inflate.from_hash(hash)`
38
+
39
+ `puts obj.a`
40
+ `puts obj.camel_case`
41
+ `puts obj.d.f.first`
42
+
43
+ `json = '{"CamelCase": "no", "json": "yes"}'`
44
+
45
+ You can also go straight from JSON, or turn off the automatic camel case conversion:
46
+
47
+ `obj = WhoopeeCushion::Inflate.from_json(json, :to_snake_keys => false)`
48
+
49
+ `puts obj.CamelCase`
50
+
51
+ Have fun.
@@ -1,3 +1,3 @@
1
1
  module WhoopeeCushion
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -21,5 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "minitest", "~> 4.7.3"
24
+
25
+ spec.add_development_dependency "byebug"
26
+ spec.add_development_dependency "recursive-open-struct"
24
27
  end
25
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whoopee-cushion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Dunkley
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.7.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: recursive-open-struct
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: Inflates JSON data recursively into structs to allow use of dot notation
56
84
  for data access.
57
85
  email: