string-cases 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +59 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +17 -0
- data/README.md +1 -1
- data/Rakefile +16 -16
- data/VERSION +1 -1
- data/lib/string-cases.rb +7 -1
- data/shippable.yml +1 -0
- data/spec/spec_helper.rb +4 -4
- data/spec/string-cases_spec.rb +11 -0
- data/string-cases.gemspec +8 -4
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 234fd7fe816c06ba2ce0b288e94767cff3ec7707
|
4
|
+
data.tar.gz: 9012818a9554c353acacfb82e4e6946a0e173e4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a52cdf579e540c2cc76ab93c749c125f24b84f228dc0a634a440ba6fcbf561723927b920de628911ece6bfbff04904846adb140fec590b1163cbc46515f624a2
|
7
|
+
data.tar.gz: 4adca1c912320e2d2725365c4e7efea9b39a0279b5304ae5e4d6f6c2bed5ecb841cc92684aab3c99fb4260508f0624bd5873820075f0d1c6b924eb1ecb6a5c68
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
Exclude:
|
5
|
+
- string-cases.gemspec
|
6
|
+
|
7
|
+
# https://github.com/AtomLinter/linter-rubocop/issues/2
|
8
|
+
Style/FileName:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 160
|
13
|
+
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Max: 50
|
16
|
+
|
17
|
+
Metrics/AbcSize:
|
18
|
+
Max: 25
|
19
|
+
|
20
|
+
Metrics/ClassLength:
|
21
|
+
Max: 250
|
22
|
+
|
23
|
+
Style/AccessModifierIndentation:
|
24
|
+
EnforcedStyle: outdent
|
25
|
+
|
26
|
+
Style/ClassAndModuleChildren:
|
27
|
+
EnforcedStyle: compact
|
28
|
+
|
29
|
+
Style/Documentation:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/EmptyLines:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/StringLiterals:
|
36
|
+
EnforcedStyle: double_quotes
|
37
|
+
|
38
|
+
Style/StringLiteralsInInterpolation:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/NilComparison:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/SignalException:
|
45
|
+
EnforcedStyle: only_raise
|
46
|
+
|
47
|
+
Style/MultilineOperationIndentation:
|
48
|
+
EnforcedStyle: indented
|
49
|
+
|
50
|
+
Style/SpaceInsideHashLiteralBraces:
|
51
|
+
EnforcedStyle: no_space
|
52
|
+
|
53
|
+
Style/TrivialAccessors:
|
54
|
+
ExactNameMatch: true
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# Disabled on purpose: https://github.com/bbatsov/rubocop/issues/1758
|
58
|
+
Style/ClosingParenthesisIndentation:
|
59
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,9 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
addressable (2.4.0)
|
5
|
+
ast (2.2.0)
|
6
|
+
astrolabe (1.3.1)
|
7
|
+
parser (~> 2.2)
|
5
8
|
builder (3.2.2)
|
6
9
|
codeclimate-test-reporter (0.4.8)
|
7
10
|
simplecov (>= 0.7.1, < 1.0.0)
|
@@ -40,7 +43,11 @@ GEM
|
|
40
43
|
multi_json (~> 1.3)
|
41
44
|
multi_xml (~> 0.5)
|
42
45
|
rack (~> 1.2)
|
46
|
+
parser (2.2.3.0)
|
47
|
+
ast (>= 1.1, < 3.0)
|
48
|
+
powerpack (0.1.1)
|
43
49
|
rack (1.6.4)
|
50
|
+
rainbow (2.0.0)
|
44
51
|
rake (10.4.2)
|
45
52
|
rdoc (3.12.2)
|
46
53
|
json (~> 1.4)
|
@@ -57,11 +64,20 @@ GEM
|
|
57
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
65
|
rspec-support (~> 3.2.0)
|
59
66
|
rspec-support (3.2.2)
|
67
|
+
rubocop (0.35.1)
|
68
|
+
astrolabe (~> 1.3)
|
69
|
+
parser (>= 2.2.3.0, < 3.0)
|
70
|
+
powerpack (~> 0.1)
|
71
|
+
rainbow (>= 1.99.1, < 3.0)
|
72
|
+
ruby-progressbar (~> 1.7)
|
73
|
+
tins (<= 1.6.0)
|
74
|
+
ruby-progressbar (1.7.5)
|
60
75
|
simplecov (0.11.1)
|
61
76
|
docile (~> 1.1.0)
|
62
77
|
json (~> 1.8)
|
63
78
|
simplecov-html (~> 0.10.0)
|
64
79
|
simplecov-html (0.10.0)
|
80
|
+
tins (1.6.0)
|
65
81
|
|
66
82
|
PLATFORMS
|
67
83
|
ruby
|
@@ -72,6 +88,7 @@ DEPENDENCIES
|
|
72
88
|
jeweler (~> 1.8.8)
|
73
89
|
rdoc (~> 3.12)
|
74
90
|
rspec (~> 3.2.0)
|
91
|
+
rubocop
|
75
92
|
|
76
93
|
BUNDLED WITH
|
77
94
|
1.11.2
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[![Build Status](https://api.shippable.com/projects/540e7b9e3479c5ea8f9ec25a/badge?branchName=master)](https://app.shippable.com/projects/540e7b9e3479c5ea8f9ec25a/builds/latest)
|
2
1
|
[![Code Climate](https://codeclimate.com/github/kaspernj/string-cases/badges/gpa.svg)](https://codeclimate.com/github/kaspernj/string-cases)
|
3
2
|
[![Test Coverage](https://codeclimate.com/github/kaspernj/string-cases/badges/coverage.svg)](https://codeclimate.com/github/kaspernj/string-cases)
|
3
|
+
[![Build Status](https://img.shields.io/shippable/540e7b9e3479c5ea8f9ec25a.svg)](https://app.shippable.com/projects/540e7b9e3479c5ea8f9ec25a/builds/latest)
|
4
4
|
|
5
5
|
# StringCases
|
6
6
|
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler"
|
5
5
|
begin
|
6
6
|
Bundler.setup(:default, :development)
|
7
7
|
rescue Bundler::BundlerError => e
|
@@ -9,41 +9,41 @@ rescue Bundler::BundlerError => e
|
|
9
9
|
$stderr.puts "Run `bundle install` to install missing gems"
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
|
-
require
|
12
|
+
require "rake"
|
13
13
|
|
14
|
-
require
|
14
|
+
require "jeweler"
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "string-cases"
|
18
18
|
gem.homepage = "http://github.com/kaspernj/string-cases"
|
19
19
|
gem.license = "MIT"
|
20
|
-
gem.summary = %
|
21
|
-
gem.description = %
|
20
|
+
gem.summary = %(Small gem for converting various string-cases to other cases.)
|
21
|
+
gem.description = %(Small gem for converting various string-cases to other cases.)
|
22
22
|
gem.email = "k@spernj.org"
|
23
23
|
gem.authors = ["kaspernj"]
|
24
24
|
# dependencies defined in Gemfile
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
27
27
|
|
28
|
-
require
|
29
|
-
require
|
28
|
+
require "rspec/core"
|
29
|
+
require "rspec/core/rake_task"
|
30
30
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
-
spec.pattern = FileList[
|
31
|
+
spec.pattern = FileList["spec/**/*_spec.rb"]
|
32
32
|
end
|
33
33
|
|
34
34
|
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
-
spec.pattern =
|
35
|
+
spec.pattern = "spec/**/*_spec.rb"
|
36
36
|
spec.rcov = true
|
37
37
|
end
|
38
38
|
|
39
|
-
task :
|
39
|
+
task default: :spec
|
40
40
|
|
41
|
-
require
|
41
|
+
require "rdoc/task"
|
42
42
|
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?(
|
43
|
+
version = File.exist?("VERSION") ? File.read("VERSION") : ""
|
44
44
|
|
45
|
-
rdoc.rdoc_dir =
|
45
|
+
rdoc.rdoc_dir = "rdoc"
|
46
46
|
rdoc.title = "string-cases #{version}"
|
47
|
-
rdoc.rdoc_files.include(
|
48
|
-
rdoc.rdoc_files.include(
|
47
|
+
rdoc.rdoc_files.include("README*")
|
48
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
49
49
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/string-cases.rb
CHANGED
@@ -4,7 +4,7 @@ class StringCases
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.camel_to_snake(str)
|
7
|
-
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)
|
@@ -30,4 +30,10 @@ class StringCases
|
|
30
30
|
|
31
31
|
str
|
32
32
|
end
|
33
|
+
|
34
|
+
def self.constantize(str)
|
35
|
+
str.to_s.split("::").inject(Module) do |mod_path, mod_to_find|
|
36
|
+
mod_path.const_get(mod_to_find)
|
37
|
+
end
|
38
|
+
end
|
33
39
|
end
|
data/shippable.yml
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "codeclimate-test-reporter"
|
2
2
|
CodeClimate::TestReporter.start
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
5
5
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "rspec"
|
7
|
+
require "string-cases"
|
8
8
|
|
9
9
|
# Requires supporting files with custom matchers and macros, etc,
|
10
10
|
# in ./support/ and its subdirectories.
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
12
|
|
13
13
|
RSpec.configure do |config|
|
14
14
|
end
|
data/spec/string-cases_spec.rb
CHANGED
@@ -30,4 +30,15 @@ describe "StringCases" do
|
|
30
30
|
expect(StringCases.singularize("categories")).to eq "category"
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
describe "#constantize" do
|
35
|
+
it "works with simple classes" do
|
36
|
+
expect(StringCases.constantize("String")).to eq String
|
37
|
+
end
|
38
|
+
|
39
|
+
it "works with namespaces" do
|
40
|
+
require "weakref"
|
41
|
+
expect(StringCases.constantize("WeakRef::RefError")).to eq WeakRef::RefError
|
42
|
+
end
|
43
|
+
end
|
33
44
|
end
|
data/string-cases.gemspec
CHANGED
@@ -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.
|
5
|
+
# stub: string-cases 0.0.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "string-cases"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.3"
|
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 = "2016-01-
|
14
|
+
s.date = "2016-01-07"
|
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 = [
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".rspec",
|
24
|
+
".rubocop.yml",
|
24
25
|
"Gemfile",
|
25
26
|
"Gemfile.lock",
|
26
27
|
"LICENSE.txt",
|
@@ -35,7 +36,7 @@ Gem::Specification.new do |s|
|
|
35
36
|
]
|
36
37
|
s.homepage = "http://github.com/kaspernj/string-cases"
|
37
38
|
s.licenses = ["MIT"]
|
38
|
-
s.rubygems_version = "2.
|
39
|
+
s.rubygems_version = "2.4.0"
|
39
40
|
s.summary = "Small gem for converting various string-cases to other cases."
|
40
41
|
|
41
42
|
if s.respond_to? :specification_version then
|
@@ -46,17 +47,20 @@ Gem::Specification.new do |s|
|
|
46
47
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
47
48
|
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
48
49
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.8"])
|
50
|
+
s.add_development_dependency(%q<rubocop>, [">= 0"])
|
49
51
|
else
|
50
52
|
s.add_dependency(%q<rspec>, ["~> 3.2.0"])
|
51
53
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
52
54
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
53
55
|
s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
|
56
|
+
s.add_dependency(%q<rubocop>, [">= 0"])
|
54
57
|
end
|
55
58
|
else
|
56
59
|
s.add_dependency(%q<rspec>, ["~> 3.2.0"])
|
57
60
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
58
61
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
59
62
|
s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
|
63
|
+
s.add_dependency(%q<rubocop>, [">= 0"])
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
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.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.8.8
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Small gem for converting various string-cases to other cases.
|
70
84
|
email: k@spernj.org
|
71
85
|
executables: []
|
@@ -76,6 +90,7 @@ extra_rdoc_files:
|
|
76
90
|
files:
|
77
91
|
- ".document"
|
78
92
|
- ".rspec"
|
93
|
+
- ".rubocop.yml"
|
79
94
|
- Gemfile
|
80
95
|
- Gemfile.lock
|
81
96
|
- LICENSE.txt
|
@@ -107,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
122
|
version: '0'
|
108
123
|
requirements: []
|
109
124
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.4.0
|
111
126
|
signing_key:
|
112
127
|
specification_version: 4
|
113
128
|
summary: Small gem for converting various string-cases to other cases.
|