strings-case 0.2.0 → 0.4.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
  SHA256:
3
- metadata.gz: dc47bee251774eb57217a3fbac0028bd94ad6b44697f364c3d9fbb9e5f23c78c
4
- data.tar.gz: 6d2f3fc1a27f70387723cb362fa665bdb243dc948306d5d6e5021bcadaf316b2
3
+ metadata.gz: 321f95c3ae804e7b64eddc3566fcec63b3be6e5f81804cc236cc4187ff1fcc59
4
+ data.tar.gz: 7aee26f0af7f322b9c54b3c7e672849e050290de91c3b604be512a5ed7a839ac
5
5
  SHA512:
6
- metadata.gz: 5c2a23a788a31480cdb8b099d39d5ec7ab58e9bbb8291810b4f89a1d34447a96f7883d599f056b91b85e8df19fbaf3c5503c3aa17e54efe543422ee1a4c23a3d
7
- data.tar.gz: 771199eab86b3a8c5e350b7b14787fe9e0b0645b583cf33465d46975dd4c97a542e02426014775fe46db287e3dac9932cbad67d68e30fc22ee504cea7d58e08c
6
+ metadata.gz: f1e29519c62ae22f61797bf59f65c76fef22e7b6050db7a6bdec4c74c13495b9d61d2fcc4b9f51710c089a0923dc9c6ca10e6bdd52d56ca34075aca730be508f
7
+ data.tar.gz: bc754e29be3e76326de7da906d214abe7299e20a51ef5837996bf0cd8a1e20f03b127900e2e3de9fccae6ca546ae83bde277c6b9bf9e474597602a2efd7c668f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.4.0] - 2023-11-19
4
+
5
+ ### Added
6
+ * Add the ability to configure acronyms on an instance
7
+
8
+ ### Changed
9
+ * Change Strings::Case to be a class to allow instantiation
10
+ * Change all conversions to apply acronyms configured on an instance
11
+ * Change all conversions to preserve non-alphanumeric characters
12
+ * Change all conversions to allow for one-letter words
13
+ * Change gemspec to only package the source files and documentation
14
+ * Change parsecase method to improve performance
15
+ * Change extensions to require core library when loaded
16
+ * Change Strings::Case class to hide constants
17
+ * Change Strings::Case class to hide instance method
18
+
19
+ ## [v0.3.0] - 2019-12-07
20
+
21
+ ### Added
22
+ * Add performance tests
23
+
24
+ ### Changed
25
+ * Change to double parsing speed and halve object allocations
26
+
3
27
  ## [v0.2.0] - 2019-11-23
4
28
 
5
29
  ### Fixed
@@ -9,5 +33,7 @@
9
33
 
10
34
  * Initial implementation and release
11
35
 
36
+ [v0.4.0]: https://github.com/piotrmurach/strings-case/compare/v0.3.0...v0.4.0
37
+ [v0.3.0]: https://github.com/piotrmurach/strings-case/compare/v0.2.0...v0.3.0
12
38
  [v0.2.0]: https://github.com/piotrmurach/strings-case/compare/v0.1.0...v0.2.0
13
- [v0.1.0]: https://github.com/piotrmurach/strings-case/compare/v0.1.0
39
+ [v0.1.0]: https://github.com/piotrmurach/strings-case/compare/03679ef...v0.1.0
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Piotr Murach
3
+ Copyright (c) 2019 Piotr Murach (piotrmurach.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -5,45 +5,35 @@
5
5
  # Strings::Case
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/strings-case.svg)][gem]
8
- [![Build Status](https://secure.travis-ci.org/piotrmurach/strings-case.svg?branch=master)][travis]
8
+ [![Actions CI](https://github.com/piotrmurach/strings-case/actions/workflows/ci.yml/badge.svg)][gh_actions_ci]
9
9
  [![Build status](https://ci.appveyor.com/api/projects/status/yr87c96wxp1cw2ep?svg=true)][appveyor]
10
10
  [![Maintainability](https://api.codeclimate.com/v1/badges/7938258c4af196a19843/maintainability)][codeclimate]
11
11
  [![Coverage Status](https://coveralls.io/repos/github/piotrmurach/strings-case/badge.svg?branch=master)][coverage]
12
- [![Inline docs](http://inch-ci.org/github/piotrmurach/strings-case.svg?branch=master)][inchpages]
13
12
 
14
13
  [gem]: http://badge.fury.io/rb/strings-case
15
- [travis]: http://travis-ci.org/piotrmurach/strings-case
14
+ [gh_actions_ci]: https://github.com/piotrmurach/strings-case/actions/workflows/ci.yml
16
15
  [appveyor]: https://ci.appveyor.com/project/piotrmurach/strings-case
17
16
  [codeclimate]: https://codeclimate.com/github/piotrmurach/strings-case/maintainability
18
17
  [coverage]: https://coveralls.io/github/piotrmurach/strings-case?branch=master
19
- [inchpages]: http://inch-ci.org/github/piotrmurach/strings-case
20
18
 
21
19
  > Convert strings to different cases.
22
20
 
23
- **Strings::Case** provides string case conversions for [Strings](https://github.com/piotrmurach/strings) utilities.
21
+ **Strings::Case** provides string case conversions for
22
+ [Strings](https://github.com/piotrmurach/strings) utilities.
24
23
 
25
- ## Motivation
26
-
27
- Popular solutions that deal with transforming string cases work well in simple cases.(Sorry ;-) With more complex strings you may get unexpected results:
28
-
29
- ```ruby
30
- ActiveSupport::Inflector.underscore("supports IPv6 on iOS?")
31
- # => "supports i_pv6 on i_os?"
32
- ```
33
-
34
- In contrast, `Strings::Case` aims to be able to transform any string to expected case:
24
+ ## Features
35
25
 
36
- ```ruby
37
- Strings::Case.underscore("supports IPv6 on iOS?")
38
- # => "supports_ipv6_on_ios"
39
- ```
26
+ * No monkey-patching String class
27
+ * Convert strings to many common cases
28
+ * Support for Unicode characters
29
+ * Preserve acronyms
40
30
 
41
31
  ## Installation
42
32
 
43
33
  Add this line to your application's Gemfile:
44
34
 
45
35
  ```ruby
46
- gem 'strings-case'
36
+ gem "strings-case"
47
37
  ```
48
38
 
49
39
  And then execute:
@@ -54,218 +44,307 @@ Or install it yourself as:
54
44
 
55
45
  $ gem install strings-case
56
46
 
57
-
58
- ## Features
59
-
60
- * No monkey-patching String class
61
- * Converts any string to specified case
62
- * Supports Unicode characters
63
- * Provides many common case transformations
64
- * Allows to preserve casing of acronyms
65
-
66
47
  ## Contents
67
48
 
68
49
  * [1. Usage](#1-usage)
69
50
  * [2. API](#2-api)
70
- * [2.1 camelcase](#21-camelcase)
71
- * [2.2 constcase](#22-constcase)
72
- * [2.3 headercase](#23-headercase)
73
- * [2.4 kebabcase | dashcase](#24-kebabcase--dashcase)
74
- * [2.5 pascalcase](#25-pascalcase)
75
- * [2.6 pathcase](#26-pathcase)
76
- * [2.7 sentencecase](#27-sentencecase)
77
- * [2.8 snakecase | underscore](#28-snakecase--underscore)
78
- * [2.9 titlecase](#29-titlecase)
51
+ * [2.1 configure](#21-configure)
52
+ * [2.2 camelcase](#22-camelcase)
53
+ * [2.3 constcase](#23-constcase)
54
+ * [2.4 headercase](#24-headercase)
55
+ * [2.5 kebabcase \| dashcase](#25-kebabcase--dashcase)
56
+ * [2.6 pascalcase](#26-pascalcase)
57
+ * [2.7 pathcase](#27-pathcase)
58
+ * [2.8 sentencecase](#28-sentencecase)
59
+ * [2.9 snakecase \| underscore](#29-snakecase--underscore)
60
+ * [2.10 titlecase](#210-titlecase)
79
61
  * [3. Extending String class](#3-extending-string-class)
80
62
 
81
63
  ## 1. Usage
82
64
 
83
- The `Strings::Case` is a module with functions for transforming between string cases:
65
+ Start by creating an instance of the `Strings::Case` class:
84
66
 
85
67
  ```ruby
86
- Strings::Case.snakecase("foo bar baz")
68
+ strings = Strings::Case.new
69
+ ```
70
+
71
+ Then, use one of many case conversion methods, for example,
72
+ the `snakecase` method:
73
+
74
+ ```ruby
75
+ strings.snakecase("FooBarBaz")
87
76
  # => "foo_bar_baz"
88
- ````
77
+ ```
89
78
 
90
- It will transform any string into expected case:
79
+ As a convenience, case conversion methods are also available on class:
91
80
 
92
81
  ```ruby
93
- Strings::Case.snakecase("supports IPv6 on iOS?")
94
- # => "supports_ipv6_on_ios"
82
+ Strings::Case.snakecase("FooBarBaz")
83
+ # => "foo_bar_baz"
95
84
  ```
96
85
 
97
- You can apply case transformations to Unicode characters:
86
+ Case conversion methods will transform any string into an expected case:
98
87
 
99
88
  ```ruby
100
- Strings::Case.snakecase("ЗдравствуйтеПривет")
89
+ strings.snakecase("supports IPv6 on iOS?")
90
+ # => "supports_i_pv6_on_i_os"
91
+ ```
92
+
93
+ The methods also support converting Unicode characters:
94
+
95
+ ```ruby
96
+ strings.snakecase("ЗдравствуйтеПривет")
101
97
  # => "здравствуйте_привет"
102
98
  ```
103
99
 
104
- Here is a quick summary of available transformations:
100
+ To preserve acronyms for all case conversions, configure them once
101
+ on an instance:
102
+
103
+ ```ruby
104
+ strings.configure do |config|
105
+ config.acronym "IPv6"
106
+ config.acronym "iOS"
107
+ end
108
+ ```
109
+
110
+ This will preserve acronyms for any case conversion method:
111
+
112
+ ```ruby
113
+ strings.snakecase("supports IPv6 on iOS?")
114
+ # => "supports_ipv6_on_ios"
115
+ ```
116
+
117
+ Or, use the `acronyms` keyword in a case conversion method:
118
+
119
+ ```ruby
120
+ strings.snakecase("supports IPv6 on iOS?", acronyms: %w[IPv6 iOS])
121
+ # => "supports_ipv6_on_ios"
122
+ ```
105
123
 
106
- | Case Type | Result |
107
- | --------- | ------- |
108
- | ```Strings::Case.camelcase("foo bar baz")``` | `"fooBarBaz"` |
109
- | ```Strings::Case.constcase("foo bar baz")``` | `"FOO_BAR_BAZ"` |
110
- | ```Strings::Case.headercase("foo bar baz")``` | `"Foo-Bar-Baz"` |
111
- | ```Strings::Case.kebabcase("foo bar baz")``` | `"foo-bar-baz"` |
112
- | ```Strings::Case.pascalcase("foo bar baz")``` | `"FooBarBaz"` |
113
- | ```Strings::Case.pathcase("foo bar baz")``` | `"foo/bar/baz"` |
114
- | ```Strings::Case.sentencecase("foo bar baz")``` | `"Foo bar baz"` |
115
- | ```Strings::Case.snakecase("foo bar baz")``` | `"foo_bar_baz"` |
116
- | ```Strings::Case.titlecase("foo bar baz")``` | `"Foo Bar Baz"` |
124
+ Here is a quick summary of available case conversions:
125
+
126
+ | Case Type | Result |
127
+ | ----------------------------- | --------------- |
128
+ | `camelcase("foo bar baz")` | `"fooBarBaz"` |
129
+ | `constcase("foo bar baz")` | `"FOO_BAR_BAZ"` |
130
+ | `headercase("foo bar baz")` | `"Foo-Bar-Baz"` |
131
+ | `kebabcase("foo bar baz")` | `"foo-bar-baz"` |
132
+ | `pascalcase("foo bar baz")` | `"FooBarBaz"` |
133
+ | `pathcase("foo bar baz")` | `"foo/bar/baz"` |
134
+ | `sentencecase("foo bar baz")` | `"Foo bar baz"` |
135
+ | `snakecase("foo bar baz")` | `"foo_bar_baz"` |
136
+ | `titlecase("foo bar baz")` | `"Foo Bar Baz"` |
117
137
 
118
138
  ## 2. API
119
139
 
120
- ### 2.1 camelcase
140
+ ### 2.1 configure
141
+
142
+ Use the `acronyms` keyword at initialization to add acronyms for all
143
+ case conversions.
121
144
 
122
- To convert a string into a camel case, that is, a case with all the words capitilized apart from the first one and compouned together without any space use `camelase` method. For example:
145
+ For example, to add `HTTP` and `XML` acronyms:
123
146
 
124
147
  ```ruby
125
- Strings::Case.camelcase("HTTP Response Code")
126
- # => "httpResponseCode"
148
+ strings = Strings::Case.new(acronyms: %w[HTTP XML])
127
149
  ```
128
150
 
129
- To preserve the acronyms use the `:acronyms` option:
151
+ After initialization, use the `configure` method to add acronyms
152
+ in a block with the `acronym` method:
130
153
 
131
154
  ```ruby
132
- Strings::Case.camelcase("HTTP Response Code", acronyms: ["HTTP"])
133
- # => "HTTPResponseCode"
155
+ strings.configure do |config|
156
+ config.acronym "HTTP"
157
+ config.acronym "XML"
158
+
159
+ # or config.acronym "HTTP", "XML"
160
+ end
134
161
  ```
135
162
 
136
- ### 2.2 constcase
163
+ Or, use the `configure` method with the `acronyms` keyword:
137
164
 
138
- To convert a string into a constant case, that is, a case with all the words uppercased and separated by underscore character use `constcase`. For example:
165
+ ```ruby
166
+ strings.configure(acronyms: %w[HTTP XML])
167
+ ```
168
+
169
+ This will result in a conversion preserving acronyms:
139
170
 
140
171
  ```ruby
141
- Strings::Case.constcase("HTTP Response Code")
142
- # => "HTTP_RESPONSE_CODE"
172
+ strings.camelcase("xml_http_request")
173
+ # => "XMLHTTPRequest"
143
174
  ```
144
175
 
145
- ### 2.3 headercase
176
+ ### 2.2 camelcase
146
177
 
147
- To covert a string into a header case, that is, a case with all the words capitalized and separated by a hypen use `headercase`. For example:
178
+ Use the `camelcase` method to convert a string into a camel case. It will
179
+ lowercase first and capitalise all remaining words, joining them by
180
+ removing any space. For example:
148
181
 
149
182
  ```ruby
150
- Strings::Case.headercase("HTTP Response Code")
151
- # => "Http-Response-Code"
183
+ strings.camelcase("PostgreSQL adapter")
184
+ # => "postgreSqlAdapter"
152
185
  ```
153
186
 
154
- To preserve the acronyms use the `:acronyms` option:
187
+ Use the `acronyms` keyword to preserve acronyms:
155
188
 
156
189
  ```ruby
157
- Strings::Case.headercase("HTTP Response Code", acronyms: ["HTTP"])
158
- # => "HTTP-Response-Code"
190
+ strings.camelcase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
191
+ # => "PostgreSQLAdapter"
159
192
  ```
160
- ### 2.4 kebabcase | dashcase
161
193
 
162
- To convert a string into a kebab case, that is, a case with all the words lowercased and separted by a dash, like a words kebabab on a skewer, use `kebabcase` or `dashcase` methods. For example:
194
+ ### 2.3 constcase
195
+
196
+ Use the `constcase` method to convert a string into a constant case. It will
197
+ uppercase all words and separate them with an underscore `_`. For example:
163
198
 
164
199
  ```ruby
165
- Strings::Case.kebabcase("HTTP Response Code")
166
- # => "http-response-code"
200
+ strings.constcase("PostgreSQL adapter")
201
+ # => "POSTGRE_SQL_ADAPTER"
167
202
  ```
168
203
 
169
- To preserve the acronyms use the `:acronyms` option:
204
+ Use the `acronyms` keyword to preserve acronyms:
170
205
 
171
206
  ```ruby
172
- Strings::Case.dashcase("HTTP Response Code", acronyms: ["HTTP"])
207
+ strings.constcase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
208
+ # => "POSTGRESQL_ADAPTER"
209
+ ```
173
210
 
174
- expect(dashed).to eq("HTTP-response-code")
211
+ ### 2.4 headercase
212
+
213
+ Use the `headercase` method to convert a string into a header case. It will
214
+ capitalise all words and separate them with a hyphen `-`. For example:
215
+
216
+ ```ruby
217
+ strings.headercase("PostgreSQL adapter")
218
+ # => "Postgre-Sql-Adapter"
175
219
  ```
176
220
 
177
- ### 2.5 pascalcase
221
+ Use the `acronyms` keyword to preserve acronyms:
178
222
 
179
- To convert a string into a pascal case, that is, a case with all the words capitilized and compounded together without a space, use `pascalcase` method. For example:
223
+ ```ruby
224
+ strings.headercase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
225
+ # => "PostgreSQL-Adapter"
226
+ ```
227
+
228
+ ### 2.5 kebabcase | dashcase
229
+
230
+ Use the `kebabcase` or `dashcase` method to convert a string into a kebab case.
231
+ It will lowercase all words and separate them with a dash `-` like a words
232
+ kebab on a skewer. For example:
180
233
 
181
234
  ```ruby
182
- Strings::Case.pascalcase("HTTP Response Code")
183
- # => "HttpResponseCode"
235
+ strings.kebabcase("PostgreSQL adapter")
236
+ # => "postgre-sql-adapter"
184
237
  ```
185
238
 
186
- To preserve the acronyms use the `:acronyms` option:
239
+ Use the `acronyms` keyword to preserve acronyms:
187
240
 
188
241
  ```ruby
189
- Strings::Case.pascalcase("HTTP Response Code")
190
- # => "HTTPResponseCode"
242
+ strings.dashcase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
243
+ # => "postgresql-adapter"
191
244
  ```
192
245
 
193
- ### 2.6 pathcase
246
+ ### 2.6 pascalcase
194
247
 
195
- To convert a string into a file path use `pathcase`:
248
+ Use the `pascalcase` method to convert a string into a Pascal case. It will
249
+ capitalise all words and join them by removing any space. For example:
196
250
 
197
251
  ```ruby
198
- Strings::Case.pathcase("HTTP Response Code")
199
- # => "http/response/code"
200
- ````
252
+ strings.pascalcase("PostgreSQL adapter")
253
+ # => "PostgreSqlAdapter"
254
+ ```
201
255
 
202
- To preserve the acronyms use the `:acronyms` option:
256
+ Use the `acronyms` keyword to preserve acronyms:
203
257
 
204
258
  ```ruby
205
- Strings::Case.pathcase("HTTP Response Code", acronyms: ["HTTP"])
206
- # => "HTTP/response/code"
259
+ strings.pascalcase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
260
+ # => "PostgreSQLAdapter"
207
261
  ```
208
262
 
209
- By default the `/` is used as a path separator. To change this use a `:sep` option. For example, on Windows the file path separator is `\`:
263
+ ### 2.7 pathcase
264
+
265
+ Use the `pathcase` to convert a string into a path case. It will lowercase
266
+ all words and join them with a forward slash `/`. For example:
210
267
 
211
268
  ```ruby
212
- Strings::Case.pathcase("HTTP Response Code", separator: "\\")
213
- # => "http\response\code"
269
+ strings.pathcase("PostgreSQL adapter")
270
+ # => "postgre/sql/adapter"
214
271
  ```
215
272
 
216
- ### 2.7 `sentencecase`
273
+ Use the `acronyms` keyword to preserve acronyms:
217
274
 
218
- To turn a string into a sentence use `sentencecase`:
275
+ ```ruby
276
+ strings.pathcase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
277
+ # => "postgresql/adapter"
278
+ ```
279
+
280
+ Use the `separator` keyword to change the default forward slash `/` path
281
+ separator. For example, to use backslash `\` as a path separator:
219
282
 
220
283
  ```ruby
221
- Strings::Case.sentencecase("HTTP Response Code")
222
- # => "Http response code"
284
+ strings.pathcase("PostgreSQL adapter", separator: "\\")
285
+ # => "postgre\\sql\\adapter"
223
286
  ```
224
287
 
225
- To preserve the `HTTP` acronym use the `:acronyms` option:
288
+ ### 2.8 sentencecase
289
+
290
+ Use the `sentencecase` to convert a string into a sentence case. It will
291
+ capitalise first and lowercase all remaining words, separating them with
292
+ space. For example:
226
293
 
227
294
  ```ruby
228
- Strings::Case.sentencecase("HTTP Response Code", acronyms: ["HTTP"])
229
- # => "HTTP response code"
295
+ strings.sentencecase("PostgreSQL adapter")
296
+ # => "Postgre sql adapter"
230
297
  ```
231
298
 
232
- ### 2.8 `snakecase` | `underscore`
299
+ Use the `acronyms` keyword to preserve acronyms:
233
300
 
234
- To convert a string into a snake case by lowercasing all the characters and separating them with an `_` use `snakecase` or `underscore` methods. For example:
301
+ ```ruby
302
+ strings.sentencecase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
303
+ # => "PostgreSQL adapter"
304
+ ```
305
+
306
+ ### 2.9 snakecase | underscore
307
+
308
+ Use the `snakecase` or `underscore` method to convert a string into
309
+ a snake case. It will lowercase all words and separate them with
310
+ an underscore `_`. For example:
235
311
 
236
312
  ```ruby
237
- Strings::Case.snakecase("HTTP Response Code")
238
- # => "http_response_code"
313
+ strings.snakecase("PostgreSQL adapter")
314
+ # => "postgre_sql_adapter"
239
315
  ```
240
316
 
241
- To preserve acronyms in your string use the `:acronyms` option. For example:
317
+ Use the `acronyms` keyword to preserve acronyms:
242
318
 
243
319
  ```ruby
244
- Strings::Case.snakecase("HTTP Response Code", acronyms: ["HTTP"])
245
- # => "HTTP_response_code"
320
+ strings.underscore("PostgreSQL adapter", acronyms: ["PostgreSQL"])
321
+ # => "postgresql_adapter"
246
322
  ```
247
323
 
248
- ### 2.9 `titlecase`
324
+ ### 2.10 titlecase
249
325
 
250
- To convert a string into a space delimited words that have their first letter capitalized use `titlecase`. For example:
326
+ Use `titlecase` to convert a string into a title case. It will capitalise all
327
+ words and separate them with space. For example:
251
328
 
252
329
  ```ruby
253
- Strings::Case.titlecase("HTTPResponseCode")
254
- # => "Http Response Code"
330
+ strings.titlecase("PostgreSQL adapter")
331
+ # => "Postgre Sql Adapter"
255
332
  ```
256
333
 
257
- To preserve the `HTTP` acronym use the `:acronyms` option:
334
+ Use the `acronyms` keyword to preserve acronyms:
258
335
 
259
336
  ```ruby
260
- Strings::Case.titlecase("HTTP response code", acronyms: ["HTTP"])
261
- # => "HTTP Response Code"
337
+ strings.titlecase("PostgreSQL adapter", acronyms: ["PostgreSQL"])
338
+ # => "PostgreSQL Adapter"
262
339
  ```
263
340
 
264
341
  ## 3. Extending String class
265
342
 
266
- Though it is highly discouraged to pollute core Ruby classes, you can add the required methods to `String` class by using refinements.
343
+ Polluting core Ruby classes globally may have unintended consequences.
344
+ Instead, consider adding the required methods to the `String` class
345
+ using refinements.
267
346
 
268
- For example, if you wish to only extend strings with `wrap` method do:
347
+ For example, to extend the `String` class with only the `snakecase` method:
269
348
 
270
349
  ```ruby
271
350
  module MyStringExt
@@ -277,7 +356,8 @@ module MyStringExt
277
356
  end
278
357
  ```
279
358
 
280
- Then `snakecase` method will be available for any strings where refinement is applied:
359
+ Then using refinement will make the `snakecase` method available
360
+ for any string:
281
361
 
282
362
  ```ruby
283
363
  using MyStringExt
@@ -286,31 +366,51 @@ using MyStringExt
286
366
  # => "foo_bar_baz"
287
367
  ```
288
368
 
289
- However, if you want to include all the **Strings::Case** methods, you can use provided extensions file:
369
+ Load `Strings::Case::Extensions` refinement to extend the `String` class
370
+ with all case conversion methods:
290
371
 
291
372
  ```ruby
292
373
  require "strings/case/extensions"
293
374
 
294
375
  using Strings::Case::Extensions
376
+
377
+ "foo bar baz".camelcase
378
+ # => "fooBarBaz"
379
+
380
+ "foo bar baz".snakecase
381
+ # => "foo_bar_baz"
295
382
  ```
296
383
 
297
384
  ## Development
298
385
 
299
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
386
+ After checking out the repo, run `bin/setup` to install dependencies.
387
+ Then, run `rake spec` to run the tests. You can also run `bin/console`
388
+ for an interactive prompt that will allow you to experiment.
300
389
 
301
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
390
+ To install this gem onto your local machine, run `bundle exec rake install`.
391
+ To release a new version, update the version number in `version.rb`, and
392
+ then run `bundle exec rake release`, which will create a git tag for
393
+ the version, push git commits and tags, and push the `.gem` file to
394
+ [rubygems.org](https://rubygems.org).
302
395
 
303
396
  ## Contributing
304
397
 
305
- Bug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/strings-case. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
398
+ Bug reports and pull requests are welcome on GitHub at
399
+ https://github.com/piotrmurach/strings-case. This project is intended to be
400
+ a safe, welcoming space for collaboration, and contributors are expected
401
+ to adhere to the [Contributor Covenant](http://contributor-covenant.org)
402
+ code of conduct.
306
403
 
307
404
  ## License
308
405
 
309
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
406
+ The gem is available as open source under the terms of the
407
+ [MIT License](https://opensource.org/licenses/MIT).
310
408
 
311
409
  ## Code of Conduct
312
410
 
313
- Everyone interacting in the Strings::Case project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/piotrmurach/strings-case/blob/master/CODE_OF_CONDUCT.md).
411
+ Everyone interacting in the Strings::Case project’s codebases, issue trackers,
412
+ chat rooms and mailing lists is expected to follow the
413
+ [code of conduct](https://github.com/piotrmurach/strings-case/blob/master/CODE_OF_CONDUCT.md).
314
414
 
315
415
  ## Copyright
316
416