http_headers-content_type 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: e425358347b1dc6325fe43e9c6c1e0fca710831e2e7b4fa8c96d544d80599ca1
4
- data.tar.gz: 2599d93f3ced13f349595478ae92fadc5e5272b08aa48e2c25512963a268fbad
3
+ metadata.gz: 6cd00370cb453e0185a30371c8d64dce1e34219d5c31c9b0d965682078ac74b5
4
+ data.tar.gz: 07ad48cc5aa6637500c88624ebfd03ec5b783bc43e7a0277cb7965fdd2481298
5
5
  SHA512:
6
- metadata.gz: ffcf97d24d2595e633a21c4fcd74954c5fe455baa2d0ad6a8c714015dabd809297bb72d2127f0b79aa9811a36d5043db0b81130e0b42670dae64e3df19442494
7
- data.tar.gz: 9d861d24ddd0dec99950a32ff492ef3b6deefd0ae85e6849c2f21f1759f5cd0b3b481ad07dde457628b04f808faf068f5985cb4c86413a031570292192a83d55
6
+ metadata.gz: 82941c088ecb74557cab5528c6adeb90ba76f7909ef24216532ace7c7701ec39004809435ef8dbc8cbfcd2881dc59563d0a41b793611a771af90da8922d3b8f7
7
+ data.tar.gz: ea714ec1a949e91e7ae6d3dcb53cde30ab349779cd30258384dbc4365e9cbad137e6ab0b604965236bf1a26d6d8332f294480c5042f0c2fc7bb31ab64c435d65
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build http_headers-content_type-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install http_headers-content_type-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install http_headers-content_type-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push http_headers-content_type-0.1.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- http_headers-content_type (0.1.0)
4
+ http_headers-content_type (0.1.1)
5
5
  http_headers-utils (>= 0.2.0, < 1.0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,78 +1,79 @@
1
- # HttpHeaders::ContentType
2
-
3
- [![Build Status: master](https://travis-ci.com/XPBytes/http_headers-content_type.svg)](https://travis-ci.com/XPBytes/http_headers-content_type)
4
- [![Gem Version](https://badge.fury.io/rb/http_headers-content_type.svg)](https://badge.fury.io/rb/http_headers-content_type)
5
- [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
6
-
7
- :nut_and_bolt: Utility to parse and sort the "Content-Type" HTTP Header
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'http_headers-content_type'
15
- ```
16
-
17
- And then execute:
18
-
19
- $ bundle
20
-
21
- Or install it yourself as:
22
-
23
- $ gem install http_headers-content_type
24
-
25
- ## Usage
26
-
27
- You can parse the "Content-Type" header. As per the RFCs, you should really have one (delimited) value but the current
28
- implementation accepts an array of values. Because there can only be one (1) `Content-Type` per request, it will always
29
- pick the _last_ one, as per the RFCs.
30
-
31
- ```ruby
32
- require 'http_headers/content_type'
33
-
34
- parsed = HttpHeaders::ContentType.new('application/json; charset=utf-8')
35
- parsed.to_s
36
- # => 'application/json; charset=utf-8'
37
- parsed.content_type
38
- # => 'application/json'
39
- parsed.charset
40
- # => 'utf-8'
41
-
42
-
43
- parsed = HttpHeaders::ContentType.new([
44
- 'application/json; charset=utf-8',
45
- 'text/html; charset=utf-8; foo=bar'
46
- ])
47
- parsed[:foo]
48
- # => 'bar'
49
- parsed.content_type
50
- # => 'text/html'
51
- parsed.charset
52
- # => 'utf-8'
53
- ```
54
-
55
- Each parsed value exposes the following methods:
56
- - `content_type`: the parsed content_type
57
- - `charset`: the charset parameter as string, or nil
58
- - `[](parameter)`: accessor for the parameter; throws if it does not exist
59
- - `to_s`: encode back to an entry to be used in a `Content-Type` header
60
-
61
- ## Related
62
-
63
- - [HttpHeaders::Utils](https://github.com/XPBytes/http_headers-utils): :nut_and_bolt: Utility belt for the HttpHeader libraries
64
- - [HttpHeaders::Accept](https://github.com/XPBytes/http_headers-accept_language): :nut_and_bolt: Utility to parse and sort the "Accept" HTTP Header
65
- - [HttpHeaders::AcceptLanguage](https://github.com/XPBytes/http_headers-accept_language): :nut_and_bolt: Utility to parse and sort the "Accept-Language" HTTP Header
66
-
67
- ## Development
68
-
69
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
70
- also run `bin/console` for an interactive prompt that will allow you to experiment.
71
-
72
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
73
- version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
74
- push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
-
76
- ## Contributing
77
-
78
- Bug reports and pull requests are welcome on GitHub at [XPBytes/http_headers-content_type](https://github.com/XPBytes/http_headers-content_type).
1
+ # HttpHeaders::ContentType
2
+
3
+ [![Build Status: master](https://travis-ci.com/XPBytes/http_headers-content_type.svg)](https://travis-ci.com/XPBytes/http_headers-content_type)
4
+ [![Gem Version](https://badge.fury.io/rb/http_headers-content_type.svg)](https://badge.fury.io/rb/http_headers-content_type)
5
+ [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
6
+
7
+ :nut_and_bolt: Utility to parse and sort the "Content-Type" HTTP Header
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'http_headers-content_type'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install http_headers-content_type
24
+
25
+ ## Usage
26
+
27
+ You can parse the "Content-Type" header. As per the RFCs, you should really have one (delimited) value but the current
28
+ implementation accepts an array of values. Because there can only be one (1) `Content-Type` per request, it will always
29
+ pick the _last_ one, as per the RFCs.
30
+
31
+ ```ruby
32
+ require 'http_headers/content_type'
33
+
34
+ parsed = HttpHeaders::ContentType.new('application/json; charset=utf-8')
35
+ parsed.to_s
36
+ # => 'application/json; charset=utf-8'
37
+ parsed.content_type
38
+ # => 'application/json'
39
+ parsed.charset
40
+ # => 'utf-8'
41
+
42
+
43
+ parsed = HttpHeaders::ContentType.new([
44
+ 'application/json; charset=utf-8',
45
+ 'text/html; charset=utf-8; foo=bar'
46
+ ])
47
+ parsed[:foo]
48
+ # => 'bar'
49
+ parsed.content_type
50
+ # => 'text/html'
51
+ parsed.charset
52
+ # => 'utf-8'
53
+ ```
54
+
55
+ Each parsed value exposes the following methods:
56
+ - `content_type`: the parsed content_type
57
+ - `charset`: the charset parameter as string, or nil
58
+ - `[](parameter)`: accessor for the parameter; throws if it does not exist
59
+ - `to_s`: encode back to an entry to be used in a `Content-Type` header
60
+
61
+ ## Related
62
+
63
+ - [HttpHeaders::Utils](https://github.com/XPBytes/http_headers-utils): :nut_and_bolt: Utility belt for the HttpHeader libraries
64
+ - [HttpHeaders::Accept](https://github.com/XPBytes/http_headers-accept): :nut_and_bolt: Utility to parse and sort the "Accept" HTTP Header
65
+ - [HttpHeaders::AcceptLanguage](https://github.com/XPBytes/http_headers-accept_language): :nut_and_bolt: Utility to parse and sort the "Accept-Language" HTTP Header
66
+ - [HttpHeaders::Link](https://github.com/XPBytes/http_headers-link): :nut_and_bolt: Utility to parse and sort the "Link" HTTP Header
67
+
68
+ ## Development
69
+
70
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
71
+ also run `bin/console` for an interactive prompt that will allow you to experiment.
72
+
73
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
74
+ version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
75
+ push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
76
+
77
+ ## Contributing
78
+
79
+ Bug reports and pull requests are welcome on GitHub at [XPBytes/http_headers-content_type](https://github.com/XPBytes/http_headers-content_type).
@@ -1,7 +1,7 @@
1
1
 
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "http_headers/content_type"
4
+ require "http_headers/content_type/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "http_headers-content_type"
@@ -1,9 +1,8 @@
1
+ require 'http_headers/content_type/version'
1
2
  require 'http_headers/utils/single'
2
3
 
3
4
  module HttpHeaders
4
5
  module ContentType
5
- VERSION = '0.1.0'
6
-
7
6
  class << self
8
7
  def new(value)
9
8
  Utils::Single.new(value, entry_klazz: Entry)
@@ -0,0 +1,5 @@
1
+ module HttpHeaders
2
+ module ContentType
3
+ VERSION = '0.1.1'
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_headers-content_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derk-Jan Karrenbeld
@@ -80,6 +80,7 @@ extensions: []
80
80
  extra_rdoc_files: []
81
81
  files:
82
82
  - ".gitignore"
83
+ - ".idea/.rakeTasks"
83
84
  - ".idea/http_headers-content_type.iml"
84
85
  - ".idea/inspectionProfiles/Project_Default.xml"
85
86
  - ".idea/misc.xml"
@@ -98,6 +99,7 @@ files:
98
99
  - bin/setup
99
100
  - http_headers-content_type.gemspec
100
101
  - lib/http_headers/content_type.rb
102
+ - lib/http_headers/content_type/version.rb
101
103
  homepage: https://github.com/XPBytes/http_headers-content_type
102
104
  licenses:
103
105
  - MIT