string_plus 0.3.0 → 0.3.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
  SHA1:
3
- metadata.gz: fb03844fc3c37a46e3d9930cb42e9faa0ef6c285
4
- data.tar.gz: 4a9b53d304f7854c0ceb597933158c1093b5c385
3
+ metadata.gz: b16284eb93cb50681c38e69d65d1feca82de961a
4
+ data.tar.gz: e76f06046520281aff0a8a829617df90228a9f28
5
5
  SHA512:
6
- metadata.gz: 60ddcda54dade6a1014a6779984efafa30173479e46b446eef93b940857e830ef19871a174edf5b7e2b198f1ec0f3bc86a04610d7cf3023cb775387ef0a8c7de
7
- data.tar.gz: 52f5635f40103ee70326c5abd92a04ed557cb26e4838b97b17af2cd80f14adc5e1b0dfd814772a2565cee073e838ce2e2826f31d64973e821e894108fcdd6f81
6
+ metadata.gz: e58cb6ec1b4bbc62d1ddf6cc78c2bf46ca4744ad86a46b59fee861dbbcfdbb35605d0242d7ca11dea3bc016215fbf06dad1894bae5f4fdc009d9a7e3a11df3b5
7
+ data.tar.gz: 7aef5df18af8895b705691843682b05887316e6344894def360e655bf3d928e5e0c3771de1e384d319e454883ad4f21062127e00460ee59437a4be2f98dbb4fc
data/README.md CHANGED
@@ -1,8 +1,45 @@
1
1
  # StringPlus
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/string_plus`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Some stuff I like on `String`s.
4
+
5
+ ## Methods added
6
+
7
+ ### `#camelcase`
8
+
9
+ Convert a space/underscore-separated String into camel case.
10
+
11
+ ```ruby
12
+ require "string_plus"
13
+ "hello_cool_world".camelcase
14
+ # => "HelloCoolWorld"
15
+ ```
16
+
17
+ ### `#lcamelcase`
18
+
19
+ Convert a space/underscore-separated String into lower camel case.
20
+
21
+ ```ruby
22
+ require "string_plus"
23
+ "hello_cool_world".lcamelcase
24
+ # => "helloCoolWorld"
25
+ ```
26
+
27
+
28
+ ### `#constantize`
29
+
30
+ Convert a string into a constant.
31
+
32
+ Acknowledgments:
33
+
34
+ * The `String` will be first camel-cased.
35
+ * You're not creating a Constant, but retrieving it. So, if it doesn't already exist, it will raise an error.
36
+
37
+ ```ruby
38
+ require "string_plus"
39
+ "basic_object".constantize
40
+ # => BasicObject
41
+ ```
4
42
 
5
- TODO: Delete this and the text above, and describe your gem
6
43
 
7
44
  ## Installation
8
45
 
@@ -20,10 +57,6 @@ Or install it yourself as:
20
57
 
21
58
  $ gem install string_plus
22
59
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
60
  ## Development
28
61
 
29
62
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/string_plus.rb CHANGED
@@ -21,7 +21,8 @@ module StringPlus
21
21
  end
22
22
 
23
23
  def constantize
24
- Object.send(:const_get, self.camelcase)
24
+ c = self.split("-").map(&:camelcase).join("::")
25
+ Object.send(:const_get, c)
25
26
  end
26
27
  end
27
28
 
@@ -1,3 +1,3 @@
1
1
  module StringPlus
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Iachetti