string-cases 0.0.1 → 0.0.2

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: b3da4f52fcaeffa940953245d9ed5bec1cdce878
4
- data.tar.gz: f12d4fddecb75fed22442c1c00a5715d47dfe374
3
+ metadata.gz: a0e92bfa8443a451353baa4e0833e0b9834bfd82
4
+ data.tar.gz: 6a386a0428fa534c5e280f13d61824f098da0a04
5
5
  SHA512:
6
- metadata.gz: 50678e9a694411a48ce914f665f7fca0d1be985c81fd69fcdb243e5bf565cef8fb397adb44445fdadb0db3b14eb321324d0db638bf7e89c6e51c1354af9f933b
7
- data.tar.gz: 4b23c24b81354e949d87cc591780471de877b8fe4d5c24205c70b1a93661af60ccd9a9b8edfc5e5f314798ea486aae039b3ac446242e13a19efafa65905103ea
6
+ metadata.gz: 6eef5f68f4c6164c603ca6cb1df9e15b76236e845b5d8e3fd64806dce735cc5685f3901d88bc4bbf5d922288d27ba56f72ecb2904c6f8ce731f20412dae73e1f
7
+ data.tar.gz: 472de8572a0ef7389f51a26b76b630866f8f366e5a584b957539e0fcff891c7b4223ca068658d7c7aaf2660bcc735d03cd97199b2836f80896b76a49927c10fc
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "rspec", "~> 2.8.0"
9
+ gem "rspec", "~> 3.2.0"
10
10
  gem "rdoc", "~> 3.12"
11
11
  gem "bundler", ">= 1.0.0"
12
12
  gem "jeweler", "~> 1.8.8"
@@ -1,13 +1,13 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.7)
4
+ addressable (2.4.0)
5
5
  builder (3.2.2)
6
- codeclimate-test-reporter (0.4.6)
6
+ codeclimate-test-reporter (0.4.8)
7
7
  simplecov (>= 0.7.1, < 1.0.0)
8
- diff-lcs (1.1.3)
8
+ diff-lcs (1.2.5)
9
9
  docile (1.1.5)
10
- faraday (0.8.9)
10
+ faraday (0.8.11)
11
11
  multipart-post (~> 1.2.0)
12
12
  git (1.2.9.1)
13
13
  github_api (0.10.1)
@@ -17,8 +17,8 @@ GEM
17
17
  multi_json (~> 1.4)
18
18
  nokogiri (~> 1.5.2)
19
19
  oauth2
20
- hashie (3.4.0)
21
- highline (1.7.1)
20
+ hashie (3.4.3)
21
+ highline (1.7.8)
22
22
  jeweler (1.8.8)
23
23
  builder
24
24
  bundler (~> 1.0)
@@ -28,9 +28,9 @@ GEM
28
28
  nokogiri (= 1.5.10)
29
29
  rake
30
30
  rdoc
31
- json (1.8.0)
32
- jwt (1.3.0)
33
- multi_json (1.11.0)
31
+ json (1.8.3)
32
+ jwt (1.5.2)
33
+ multi_json (1.11.2)
34
34
  multi_xml (0.5.5)
35
35
  multipart-post (1.2.0)
36
36
  nokogiri (1.5.10)
@@ -40,23 +40,28 @@ GEM
40
40
  multi_json (~> 1.3)
41
41
  multi_xml (~> 0.5)
42
42
  rack (~> 1.2)
43
- rack (1.6.0)
43
+ rack (1.6.4)
44
44
  rake (10.4.2)
45
45
  rdoc (3.12.2)
46
46
  json (~> 1.4)
47
- rspec (2.8.0)
48
- rspec-core (~> 2.8.0)
49
- rspec-expectations (~> 2.8.0)
50
- rspec-mocks (~> 2.8.0)
51
- rspec-core (2.8.0)
52
- rspec-expectations (2.8.0)
53
- diff-lcs (~> 1.1.2)
54
- rspec-mocks (2.8.0)
55
- simplecov (0.9.2)
47
+ rspec (3.2.0)
48
+ rspec-core (~> 3.2.0)
49
+ rspec-expectations (~> 3.2.0)
50
+ rspec-mocks (~> 3.2.0)
51
+ rspec-core (3.2.3)
52
+ rspec-support (~> 3.2.0)
53
+ rspec-expectations (3.2.1)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.2.0)
56
+ rspec-mocks (3.2.1)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.2.0)
59
+ rspec-support (3.2.2)
60
+ simplecov (0.11.1)
56
61
  docile (~> 1.1.0)
57
- multi_json (~> 1.0)
58
- simplecov-html (~> 0.9.0)
59
- simplecov-html (0.9.0)
62
+ json (~> 1.8)
63
+ simplecov-html (~> 0.10.0)
64
+ simplecov-html (0.10.0)
60
65
 
61
66
  PLATFORMS
62
67
  ruby
@@ -66,4 +71,7 @@ DEPENDENCIES
66
71
  codeclimate-test-reporter
67
72
  jeweler (~> 1.8.8)
68
73
  rdoc (~> 3.12)
69
- rspec (~> 2.8.0)
74
+ rspec (~> 3.2.0)
75
+
76
+ BUNDLED WITH
77
+ 1.11.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,22 +1,22 @@
1
1
  class StringCases
2
2
  def self.snake_to_camel(str)
3
- return str.to_s.split("_").map{|w| w.capitalize }.join("")
3
+ str.to_s.split("_").map(&:capitalize).join("")
4
4
  end
5
5
 
6
6
  def self.camel_to_snake(str)
7
- return str.to_s.gsub(/(.)([A-Z])/,'\1_\2').downcase
7
+ str.to_s.gsub(/(.)([A-Z])/,'\1_\2').downcase
8
8
  end
9
9
 
10
10
  def self.pluralize(str)
11
11
  str = "#{str}"
12
12
 
13
- if str.end_with?("y")
13
+ if str.match(/([^aeiouy]|qu)y$/i)
14
14
  str = str.gsub(/y\Z/, "ies")
15
15
  else
16
16
  str << "s"
17
17
  end
18
18
 
19
- return str
19
+ str
20
20
  end
21
21
 
22
22
  def self.singularize(str)
@@ -28,6 +28,6 @@ class StringCases
28
28
  str = str.gsub(/s\Z/, "")
29
29
  end
30
30
 
31
- return str
31
+ str
32
32
  end
33
33
  end
@@ -1,31 +1,33 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require "spec_helper"
2
2
 
3
3
  describe "StringCases" do
4
4
  it "#camel_to_snake" do
5
- StringCases.camel_to_snake("TestSomethingWee").should eq "test_something_wee"
5
+ expect(StringCases.camel_to_snake("TestSomethingWee")).to eq "test_something_wee"
6
6
  end
7
7
 
8
8
  it "#snake_to_camel" do
9
- StringCases.snake_to_camel("test_something_wee").should eq "TestSomethingWee"
9
+ expect(StringCases.snake_to_camel("test_something_wee")).to eq "TestSomethingWee"
10
10
  end
11
11
 
12
12
  describe "#pluralize" do
13
13
  it "pluralizes normal words" do
14
- StringCases.pluralize("user").should eq "users"
14
+ expect(StringCases.pluralize("user")).to eq "users"
15
+ expect(StringCases.pluralize("key")).to eq "keys"
15
16
  end
16
17
 
17
18
  it "pluralizes words ending with 'y'" do
18
- StringCases.pluralize("category").should eq "categories"
19
+ expect(StringCases.pluralize("category")).to eq "categories"
19
20
  end
20
21
  end
21
22
 
22
23
  describe "#singularize" do
23
24
  it "singularizes normal words" do
24
- StringCases.singularize("users").should eq "user"
25
+ expect(StringCases.singularize("users")).to eq "user"
26
+ expect(StringCases.singularize("keys")).to eq "key"
25
27
  end
26
28
 
27
29
  it "singularizes words ending with 'ies'" do
28
- StringCases.singularize("categories").should eq "category"
30
+ expect(StringCases.singularize("categories")).to eq "category"
29
31
  end
30
32
  end
31
33
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: string-cases 0.0.1 ruby lib
5
+ # stub: string-cases 0.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "string-cases"
9
- s.version = "0.0.1"
9
+ s.version = "0.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["kaspernj"]
14
- s.date = "2015-03-18"
14
+ s.date = "2016-01-06"
15
15
  s.description = "Small gem for converting various string-cases to other cases."
16
16
  s.email = "k@spernj.org"
17
17
  s.extra_rdoc_files = [
@@ -35,25 +35,25 @@ Gem::Specification.new do |s|
35
35
  ]
36
36
  s.homepage = "http://github.com/kaspernj/string-cases"
37
37
  s.licenses = ["MIT"]
38
- s.rubygems_version = "2.4.0"
38
+ s.rubygems_version = "2.2.2"
39
39
  s.summary = "Small gem for converting various string-cases to other cases."
40
40
 
41
41
  if s.respond_to? :specification_version then
42
42
  s.specification_version = 4
43
43
 
44
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
45
+ s.add_development_dependency(%q<rspec>, ["~> 3.2.0"])
46
46
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
47
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
48
48
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.8"])
49
49
  else
50
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
50
+ s.add_dependency(%q<rspec>, ["~> 3.2.0"])
51
51
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
52
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
53
53
  s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
54
54
  end
55
55
  else
56
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
56
+ s.add_dependency(%q<rspec>, ["~> 3.2.0"])
57
57
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
58
58
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
59
59
  s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string-cases
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.0
19
+ version: 3.2.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.8.0
26
+ version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.4.0
110
+ rubygems_version: 2.2.2
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Small gem for converting various string-cases to other cases.