possessify 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 47fc4066547ff1cfd6040ab4560f15083be4d4db
4
+ data.tar.gz: 5a272221bb54e2d03038fabb7bf60f84243017fc
5
+ SHA512:
6
+ metadata.gz: df3d7bb90d1ee1c6fa207d67d651ba8ddc2b52e467743905863d7b434f389a90e71e7988ab7fe3afca01c10f3d9b56a5242247d7b3a237cc0a8b5d714c43e8eb
7
+ data.tar.gz: 4c2c6cdc7751e9d2e2c6193c3c954c36766a56083231f2b0ded7deb2f740b2e30a742fbea01bd34ba048f2f7e7193922d2071ed88c8f7806c7f1f8e01c24badc
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ rdoc
@@ -8,17 +8,20 @@ Possessify extends the Ruby String class adding functionality to make strings po
8
8
 
9
9
  == Examples
10
10
 
11
- "Dave".possessive #=> "Dave's"
12
- "Xerxes".possessive #=> "Xerxes'"
11
+ "Dave".possessive #=> "Dave's"
12
+ "Xerxes".possessive #=> "Xerxes'"
13
13
 
14
- "Dave's".non_possessive #=> "Dave"
15
- "Xerxes'".non_possessive #=> "Xerxes"
14
+ "Dave's".non_possessive #=> "Dave"
15
+ "Xerxes'".non_possessive #=> "Xerxes"
16
16
 
17
- "Dave's".possessive? #=> true
18
- "Dave".possessive? #=> false
17
+ "Dave's".possessive? #=> true
18
+ "Dave".possessive? #=> false
19
19
 
20
- "Dave's".non_possessive? #=> false
21
- "Dave".non_possessive? #=> true
20
+ "Dave's".non_possessive? #=> false
21
+ "Dave".non_possessive? #=> true
22
22
 
23
+ "John".possessive_suffix #=> "'s"
24
+ "James".possessive_suffix #=> "'"
23
25
 
24
- Copyright (c) 2011 David Busse, released under the MIT license
26
+
27
+ Copyright (c) 2014 David Busse, released under the MIT license
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
  require 'bundler'
5
5
 
6
6
  Bundler::GemHelper.install_tasks
@@ -9,7 +9,7 @@ desc 'Default: run unit tests.'
9
9
  task :default => :test
10
10
 
11
11
  desc 'Test the possessify plugin.'
12
- Rake::TestTask.new(:test) do |t|
12
+ Rake::TestTask.new do |t|
13
13
  t.libs << 'lib'
14
14
  t.libs << 'test'
15
15
  t.pattern = 'test/**/*_test.rb'
@@ -17,10 +17,10 @@ Rake::TestTask.new(:test) do |t|
17
17
  end
18
18
 
19
19
  desc 'Generate documentation for the possessify plugin.'
20
- Rake::RDocTask.new(:rdoc) do |rdoc|
20
+ RDoc::Task.new(:rdoc) do |rdoc|
21
21
  rdoc.rdoc_dir = 'rdoc'
22
22
  rdoc.title = 'Possessify'
23
23
  rdoc.options << '--line-numbers' << '--inline-source'
24
24
  rdoc.rdoc_files.include('README.rdoc')
25
25
  rdoc.rdoc_files.include('lib/**/*.rb')
26
- end
26
+ end
@@ -1,7 +1,6 @@
1
1
  module Possessify
2
2
 
3
3
  String.class_eval do
4
-
5
4
  ##
6
5
  # :call-seq:
7
6
  # str.possessive => new_str
@@ -10,19 +9,19 @@ module Possessify
10
9
  # "Dave".possessive #=> "Dave's"
11
10
  # "Xerxes".possessive #=> "Xerxes'"
12
11
  def possessive
13
- unless self.possessive? || self.blank?
14
- str = self + (self[-1,1] && self[-1,1].downcase == "s" ? "'" : "'s")
12
+ unless self.possessive? || self.empty?
13
+ str = self + self.possessive_suffix
15
14
  end
16
15
  str || self
17
16
  end
18
-
17
+
19
18
  ##
20
19
  # :call-seq:
21
20
  # str.non_possessive => new_str
22
21
  #
23
22
  # Returns a new string that is the non-possessive form of <i>str</i>.
24
23
  # "Dave's".non_possessive #=> "Dave"
25
- # "Xerxes'".non_possessive #=> "Xerxes"
24
+ # "Xerxes'".non_possessive #=> "Xerxes"
26
25
  def non_possessive
27
26
  if self.possessive?
28
27
  unless self.chomp!("'s")
@@ -31,7 +30,7 @@ module Possessify
31
30
  end
32
31
  self
33
32
  end
34
-
33
+
35
34
  ##
36
35
  # :call-seq:
37
36
  # str.possessive? => true or false
@@ -42,7 +41,7 @@ module Possessify
42
41
  def possessive?
43
42
  self[-2,2] && (self[-2,2].downcase == "'s" || self[-2,2].downcase == "s'")
44
43
  end
45
-
44
+
46
45
  ##
47
46
  # :call-seq:
48
47
  # str.non_possessive? => true or false
@@ -53,7 +52,19 @@ module Possessify
53
52
  def non_possessive?
54
53
  !self.possessive?
55
54
  end
56
-
55
+
56
+ ##
57
+ # :call-seq:
58
+ # str.possessive_suffix => new_str
59
+ #
60
+ # Returns a new string of the possessive suffix regardless of wehether
61
+ # the string is already in possessive form or not.
62
+ # "Dave's".possessive_suffix #=> "'s"
63
+ # "Dave".possessive_suffix #=> "'s"
64
+ # "Xerxes'".possessive_suffix #=> "'"
65
+ def possessive_suffix
66
+ str = self.non_possessive
67
+ (str[-1,1] && str[-1,1].downcase == "s") ? "'" : "'s"
68
+ end
57
69
  end
58
-
59
70
  end
@@ -1,3 +1,3 @@
1
1
  module Possessify
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -5,6 +5,7 @@ require "possessify/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "possessify"
7
7
  s.version = Possessify::VERSION
8
+ s.licenses = ['MIT']
8
9
  s.platform = Gem::Platform::RUBY
9
10
  s.authors = ["David Busse"]
10
11
  s.email = ["dpb@essub.com"]
@@ -12,9 +13,10 @@ Gem::Specification.new do |s|
12
13
  s.summary = %q{Possessify extends the Ruby String class adding functionality to make strings possessive and non-possessive.}
13
14
  s.description = %q{Possessify extends the Ruby String class adding functionality to make strings possessive and non-possessive. Methods include possessive, non_possessive, and possessive?}
14
15
 
15
-
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency 'minitest', '~> 5.4'
20
22
  end
@@ -0,0 +1,66 @@
1
+ require 'test_helper'
2
+
3
+ describe Possessify do
4
+
5
+ describe "#possessive" do
6
+ it "should make singular string possessive" do
7
+ "Dave".possessive.must_equal "Dave's"
8
+ end
9
+
10
+ it "should make string ending in s possessive" do
11
+ "Xerxes".possessive.must_equal "Xerxes'"
12
+ "XerxeS".possessive.must_equal "XerxeS'"
13
+ end
14
+
15
+ it "should make single character string possesive" do
16
+ "D".possessive.must_equal "D's"
17
+ "S".possessive.must_equal "S'"
18
+ end
19
+
20
+ it "should do nothing if string already possessive" do
21
+ "Dave's".possessive.must_equal "Dave's"
22
+ "Xerxes'".possessive.must_equal "Xerxes'"
23
+ end
24
+
25
+ it "should do nothing if string is empty" do
26
+ "".possessive.must_equal ""
27
+ end
28
+ end
29
+
30
+ describe "#non_possessive" do
31
+ it "should make singular possessive string non-possesive" do
32
+ "Dave's".non_possessive.must_equal "Dave"
33
+ end
34
+
35
+ it "should make possesive string ending in s non_possesive" do
36
+ "Xerxes'".non_possessive.must_equal "Xerxes"
37
+ "XerxeS'".non_possessive.must_equal "XerxeS"
38
+ end
39
+ end
40
+
41
+ describe "#possessive?" do
42
+ it "should return true for possessive string" do
43
+ "Dave's".possessive?.must_equal true
44
+ "Xerxes'".possessive?.must_equal true
45
+ end
46
+
47
+ it "should return false for non-possessive string" do
48
+ "Dave".possessive?.must_equal false
49
+ "Xerxes".possessive?.must_equal false
50
+ end
51
+ end
52
+
53
+ describe "#possessive_suffix" do
54
+ it "should return the appropriate suffix for strings that are not already possessive" do
55
+ "Dave".possessive_suffix.must_equal "'s"
56
+ "Xerxes".possessive_suffix.must_equal "'"
57
+ "John".possessive_suffix.must_equal "'s"
58
+ "James".possessive_suffix.must_equal "'"
59
+ end
60
+
61
+ it "should return the appropriate suffix for strings that are already possessive" do
62
+ "Dave's".possessive_suffix.must_equal "'s"
63
+ "Xerxes'".possessive_suffix.must_equal "'"
64
+ end
65
+ end
66
+ end
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require 'test/unit'
3
- require 'active_support'
2
+ require 'minitest/autorun'
4
3
 
5
4
  require File.dirname(__FILE__) + '/../init'
metadata CHANGED
@@ -1,35 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: possessify
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 2
10
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - David Busse
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-02-01 00:00:00 -06:00
19
- default_executable:
20
- dependencies: []
21
-
22
- description: Possessify extends the Ruby String class adding functionality to make strings possessive and non-possessive. Methods include possessive, non_possessive, and possessive?
23
- email:
11
+ date: 2014-10-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.4'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.4'
27
+ description: Possessify extends the Ruby String class adding functionality to make
28
+ strings possessive and non-possessive. Methods include possessive, non_possessive,
29
+ and possessive?
30
+ email:
24
31
  - dpb@essub.com
25
32
  executables: []
26
-
27
33
  extensions: []
28
-
29
34
  extra_rdoc_files: []
30
-
31
- files:
32
- - .gitignore
35
+ files:
36
+ - ".gitignore"
33
37
  - Gemfile
34
38
  - LICENSE
35
39
  - README.rdoc
@@ -39,42 +43,33 @@ files:
39
43
  - lib/possessify/possessify.rb
40
44
  - lib/possessify/version.rb
41
45
  - possessify.gemspec
42
- - test/possessify_test.rb
46
+ - test/possessify/possessify_test.rb
43
47
  - test/test_helper.rb
44
- has_rdoc: true
45
48
  homepage: http://github.com/dpbus/possessify
46
- licenses: []
47
-
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
48
52
  post_install_message:
49
53
  rdoc_options: []
50
-
51
- require_paths:
54
+ require_paths:
52
55
  - lib
53
- required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
56
58
  - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
62
- required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
65
63
  - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
71
66
  requirements: []
72
-
73
67
  rubyforge_project:
74
- rubygems_version: 1.4.2
68
+ rubygems_version: 2.2.2
75
69
  signing_key:
76
- specification_version: 3
77
- summary: Possessify extends the Ruby String class adding functionality to make strings possessive and non-possessive.
78
- test_files:
79
- - test/possessify_test.rb
70
+ specification_version: 4
71
+ summary: Possessify extends the Ruby String class adding functionality to make strings
72
+ possessive and non-possessive.
73
+ test_files:
74
+ - test/possessify/possessify_test.rb
80
75
  - test/test_helper.rb
@@ -1,50 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PossessifyTest < ActiveSupport::TestCase
4
-
5
- # tests for possessive method
6
- test "should make singular string possessive" do
7
- assert_equal "Dave's", "Dave".possessive
8
- end
9
-
10
- test "should make string ending in s possessive" do
11
- assert_equal "Xerxes'", "Xerxes".possessive
12
- assert_equal "XerxeS'", "XerxeS".possessive
13
- end
14
-
15
- test "should make single character string possesive" do
16
- assert_equal "D's", "D".possessive
17
- assert_equal "S'", "S".possessive
18
- end
19
-
20
- test "should do nothing if string already possessive" do
21
- assert_equal "Dave's", "Dave's".possessive
22
- assert_equal "Xerxes'", "Xerxes'".possessive
23
- end
24
-
25
- test "should do nothing if string is empty" do
26
- assert_equal "", "".possessive
27
- end
28
-
29
- # tests for non_possessive method
30
- test "should make singular possessive string non-possesive" do
31
- assert_equal "Dave", "Dave's".non_possessive
32
- end
33
-
34
- test "should make possesive string ending in s non_possesive" do
35
- assert_equal "Xerxes", "Xerxes'".non_possessive
36
- assert_equal "XerxeS", "XerxeS'".non_possessive
37
- end
38
-
39
- # tests for possessive? method
40
- test "should return true for possessive string" do
41
- assert_equal true, "Dave's".possessive?
42
- assert_equal true, "Xerxes'".possessive?
43
- end
44
-
45
- test "should return false for non-possessive string" do
46
- assert_equal false, "Dave".possessive?
47
- assert_equal false, "Xerxes".possessive?
48
- end
49
-
50
- end