lucky_case 0.2.2 → 0.2.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
  SHA256:
3
- metadata.gz: 8a436c523f2a63b7411b894d146a89725c153dfd3970f3f22d49be49dbd35882
4
- data.tar.gz: 3b3faaac0ec66f6f47e82b3a802cdd2ce71b666a70ae01f6fea5c4e344303b37
3
+ metadata.gz: bfe36f3ecf272ce46d7350964f6396949e54b49544e2d4a886b27cba698acedd
4
+ data.tar.gz: 99e2745316e403bd0c1258bfc5db260da120b3215f224d38efee03a5bcc46392
5
5
  SHA512:
6
- metadata.gz: 146fee7851d89d9e1dacba0dac0012cf223285fb94e2d723270fe0111af0c4b366714bb8ffdc2836387b48a1046421cf45bdaca5c3822409f800b602554a1afd
7
- data.tar.gz: a5c74f03bb733a25a3a246bdebdc27c04c1ee187bc973356e9893f678c50d4ef72c5fb149633319e0bc5649f133502b22aa224b6c64947363edcd9c0da8ae4b6
6
+ metadata.gz: 704d45b0cd6df44c2097b467759a0a4ec58d42b0fdbeed78b3cf11f8012b68aae9fd9beb2bb23fa25224338d876e93daf1001b7616491665224c6ebe45dcdbd1
7
+ data.tar.gz: 60d487477cf8d5515ec135a370aaa97b78665ad6ec060f63a29e0190858ea7ddc5eb09dd1642d15da2ff3bc03c378878e41e2a228649bb646ecd5dbb70f901df
data/README.md CHANGED
@@ -25,7 +25,7 @@ Useful when working with conventions, where class names, method names and file n
25
25
 
26
26
  You can either use the static LuckyCase class with its method or optionally monkey patch the String class.
27
27
 
28
- ### Use the static class only
28
+ ### Approach 1: Using the static class
29
29
  ```ruby
30
30
  require 'lucky_case'
31
31
 
@@ -42,8 +42,10 @@ LuckyCase.upper_word_case('PascalToUpperWord') # => 'PASCAL TO UPPER WOR
42
42
  LuckyCase.capital_word_case('snake_to_capital_word') # => 'Snake To Capital Word'
43
43
  LuckyCase.sentence_case('snake_to_sentence_case') # => 'Snake to sentence case'
44
44
  LuckyCase.mixed_case('example_snake_string') # => 'Example-snake_STRING'
45
+
45
46
  # converter by type
46
47
  LuckyCase.convert_case('some_snake', :pascal_case) # => 'SomeSnake'
48
+
47
49
  # transformers
48
50
  LuckyCase.lower_case('Some_FuckingShit') # => 'some_fuckingshit'
49
51
  LuckyCase.upper_case('Some_FuckingShit') # => 'SOME_FUCKINGSHIT'
@@ -55,9 +57,11 @@ LuckyCase.constantize('SOME_CONSTANT') # => SomeConstant
55
57
  LuckyCase.constantize('some/path_example/folder') # => Some::PathExample::Folder
56
58
  LuckyCase.deconstantize(SomeConstant) # => 'some_constant'
57
59
  LuckyCase.deconstantize(Some::PathExample::Folder, case_type: :camel_case) # => 'some/pathExample/folder'
60
+
58
61
  # identifiers
59
62
  LuckyCase.case('this_can_only_be_snake_case') # => :snake_case
60
63
  LuckyCase.cases('validformultiple') # => [ :snake_case, :camel_case, :dash_case, :word_case ]
64
+
61
65
  # checkers
62
66
  LuckyCase.snake_case?('valid_snake_case') # => true
63
67
  LuckyCase.upper_snake_case?('UPPER_SNAKE') # => true
@@ -81,7 +85,7 @@ LuckyCase.valid_case_string?('validString') # => true
81
85
  LuckyCase.valid_case_string?('1nV4lid$tring') # => false
82
86
  ```
83
87
 
84
- ### Monkey patch the string class
88
+ ### Approach 2: Monkey patch the string class
85
89
 
86
90
  With monkey patching you can access the same methods (except deconstantize, valid_case_type?) of LuckyCase directly from strings.
87
91
  Additionally they provide versions with exclamation mark for direct manipulation.
@@ -96,10 +100,12 @@ a = 'ExampleString'
96
100
  a.pascal_case? # => true
97
101
  a.snake_case # => 'example_string'
98
102
  a # => 'ExampleString'
103
+
99
104
  # string variable manipulation
100
105
  a.snake_case! # => 'example_string'
101
106
  a # => 'example_string'
102
107
  ...
108
+
103
109
  # identifiers
104
110
  # got a other method name here because 'case' might be to common and cause conflicts
105
111
  b = 'example'
@@ -1,3 +1,3 @@
1
1
  module LuckyCase
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucky_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthäus J. N. Beyrle