Skip to content

Commit

Permalink
Merge pull request #7 from benSlaughter/development
Browse files Browse the repository at this point in the history
Patch: Updated modify regex to include numbers in look back
  • Loading branch information
benSlaughter committed Sep 16, 2015
2 parents ab5f6bc + fd61b69 commit 1a13f8d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/utilise/augment/modify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def space

# Splits up the current string into an array and normalises it
def split_up
regex = /(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|(?=_)|(?= )/
regex = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|(?=_)|(?= )/
arr = to_s.split(regex)
arr.map!(&:downcase)
arr.map!(&:strip)
Expand Down
4 changes: 2 additions & 2 deletions lib/utilise/version.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Utilise
module Utilise
# The current gem version
VERSION = '0.6.0'
VERSION = '0.6.1'
# The version update date
DATE = '2015-09-10'
DATE = '2015-09-16'
# Debug output message
MSG = 'Version %s %s (running on %s-%s)'

Expand Down
36 changes: 36 additions & 0 deletions spec/utilise/string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,26 @@
expect('CamelCase'.camel).to eq 'camelCase'
end

it 'returns a camel case from numeric camel case' do
expect('Camel1Case'.camel).to eq 'camel1Case'
end

it 'returns a camel case from snake case' do
expect('camel_case'.camel).to eq 'camelCase'
end

it 'returns a camel case from numeric snake case' do
expect('camel1_case'.camel).to eq 'camel1Case'
end

it 'returns a camel case from space case' do
expect('camel case'.camel).to eq 'camelCase'
end

it 'returns a camel case from numeric space case' do
expect('camel1 case'.camel).to eq 'camel1Case'
end

it 'returns a camel case from complex camel case' do
expect('CamelONECase'.camel).to eq 'camelOneCase'
end
Expand All @@ -66,14 +78,26 @@
expect('SnakeCase'.snake).to eq 'snake_case'
end

it 'returns a snake case from numeric camel case' do
expect('Snake1Case'.snake).to eq 'snake1_case'
end

it 'returns a snake case from snake case' do
expect('snake_case'.snake).to eq 'snake_case'
end

it 'returns a snake case from numeric snake case' do
expect('snake1_case'.snake).to eq 'snake1_case'
end

it 'returns a snake case from space case' do
expect('snake case'.snake).to eq 'snake_case'
end

it 'returns a snake case from numeric space case' do
expect('snake1 case'.snake).to eq 'snake1_case'
end

it 'returns a snake case from complex camel case' do
expect('SnakeONECase'.snake).to eq 'snake_one_case'
end
Expand All @@ -84,14 +108,26 @@
expect('SpaceCase'.space).to eq 'space case'
end

it 'returns a space case from numeric camel case' do
expect('SpaceCase'.space).to eq 'space case'
end

it 'returns a space case from snake case' do
expect('space_case'.space).to eq 'space case'
end

it 'returns a space case from numeric snake case' do
expect('space1_case'.space).to eq 'space1 case'
end

it 'returns a space case from space case' do
expect('space case'.space).to eq 'space case'
end

it 'returns a space case from numeric space case' do
expect('space1 case'.space).to eq 'space1 case'
end

it 'returns a space case from complex camel case' do
expect('SpaceONECase'.space).to eq 'space one case'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/utilise/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Utilise do
describe '.version' do
it 'should return the current gem version' do
expect(Utilise.version).to eq('0.6.0')
expect(Utilise.version).to eq('0.6.1')
end

it 'should return the current gem version with debug information' do
Expand Down

0 comments on commit 1a13f8d

Please sign in to comment.