sentencify 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjU1NmJiYzIwYjE4OGQ3YWVlOTdlNmI3MGVhODgwMTgwMGU1MWFkMQ==
5
- data.tar.gz: !binary |-
6
- YjNjMTRhZDI1YThmNGRiNTM5ODEwMWNlOGQ1ZDQzMmFmMTQyYWViMA==
3
+ metadata.gz: fda8a072bc1ac3c94f1fe104bbfd7d3b32d33605
4
+ data.tar.gz: 628fa24f4d69fc1a1868593d61d19f49c8b37445
7
5
  !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NjA0M2RhZmE3YWJiZTYxYzlkZTdkMWFiMDI1YzlhMjVjOTZhZGQzODlmY2Ey
10
- YjhlMTI3OTY2NDYxODQyZmIzZjliODcxYTIwZDA5ZDJlMDkxZDU4ZmQxMjIw
11
- Mjc4MWIzYzQ2M2UxOWFmY2QyMTc4YTQyMzNhMDExOGQ5NDQ1OGM=
12
- data.tar.gz: !binary |-
13
- MmUxYTc2NGRlZjE2NDU3NjJhMmI3NjBiNDIzNTY0OTJiMzg3MTlkYzIwMDU1
14
- ZThkNGI2NzE4MzJjNTM5OGU0ZmZkYjYzMTA2M2E3YmM2YzIxZGRjYWIyNWQ3
15
- NzlhMDU5NGYwNGVlMjU5ZWYyZmZhNzI1MDA0NWNhZjMxOGU5MGE=
6
+ metadata.gz: 8f47f5dbfb38fa354d1810c403f8ab17a7df8cf91eab12c51492407e339a03685403ecc2cb04b427b700dd94df138ece161e659e2f9f1666dc96f59b88aeb6e6
7
+ data.tar.gz: c4b0397b02e0fa8edf70861695a255d7620f6f7dcf62a2d703754298886b564df8d9f46a5db9aac08546066b54197d0c27589d92eb9f34624fcbac1605a09604
@@ -1 +1 @@
1
- 1.9.3
1
+ 2.0.0-rc1
@@ -1,20 +1,26 @@
1
- ## 0.3.0 (25/07/13)
1
+ ## Next release
2
+
3
+ ## 0.4.0 (01/13/14)
4
+
5
+ * Accept `Array` composed with strings (without key)
6
+
7
+ ## 0.3.0 (07/25/13)
2
8
 
3
9
  * Sentencize images with `sentencize_images` helper
4
10
  * Refactor specs
5
11
 
6
- ## 0.2.0 (11/07/13)
12
+ ## 0.2.0 (07/11/13)
7
13
 
8
14
  * Add specs
9
15
 
10
- ## 0.1.0 (01/07/13)
16
+ ## 0.1.0 (07/01/13)
11
17
 
12
18
  * Add images support
13
19
 
14
- ## 0.0.2 (20/06/13)
20
+ ## 0.0.2 (06/20/13)
15
21
 
16
22
  * Fix bug on authorized keys
17
23
 
18
- ## 0.0.1 (20/06/13)
24
+ ## 0.0.1 (06/20/13)
19
25
 
20
26
  * First release
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Sentencify
2
2
 
3
- [![Build Status](https://travis-ci.org/baptistelecocq/sentencify.png?branch=develop)](https://travis-ci.org/baptistelecocq/sentencify)
4
- [![Coverage Status](https://coveralls.io/repos/baptistelecocq/sentencify/badge.png?branch=develop)](https://coveralls.io/r/baptistelecocq/sentencify?branch=develop)
3
+ [![Build Status](https://travis-ci.org/tiste/sentencify.png?branch=develop)](https://travis-ci.org/tiste/sentencify)
4
+ [![Coverage Status](https://coveralls.io/repos/tiste/sentencify/badge.png?branch=develop)](https://coveralls.io/r/tiste/sentencify?branch=develop)
5
5
 
6
6
  With Sentencify, you can create sentences with array of Active Record objects.
7
7
  It supports `I18n`.
@@ -37,12 +37,16 @@ In your controller:
37
37
  def index
38
38
  @users = User.all
39
39
  end
40
+
41
+ names = ['John', 'Doe']
40
42
  ```
41
43
 
42
44
  In your `index.html.erb` view:
43
45
 
44
46
  ```rb
45
47
  @users.sentencize(on: :login)
48
+
49
+ names.sentencize
46
50
  ```
47
51
 
48
52
  It will display all your users by login with a default limit of 5.
@@ -5,7 +5,6 @@ class Array
5
5
  assert_sentenciable options
6
6
 
7
7
  default_connectors = {
8
- on: :title,
9
8
  image: false,
10
9
  limit: 5,
11
10
  empty: 'No element found',
@@ -23,7 +22,7 @@ class Array
23
22
 
24
23
  options = default_connectors.merge! options
25
24
  will_sentencized = self.dup
26
- will_sentencized = will_sentencized.map! { |o| o[options[:on]] } unless options[:image]
25
+ will_sentencized = will_sentencized.map! { |o| o[options[:on]] } if options[:on] && !options[:image]
27
26
 
28
27
  case length
29
28
  when 0
@@ -1,3 +1,3 @@
1
1
  module Sentencify
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['baptiste.lecocq@gmail.com']
11
11
  spec.description = 'With Sentencify, you can create sentences with array of Active Record objects. It supports I18n.'
12
12
  spec.summary = 'Create sentences with array of Active Record objects'
13
- spec.homepage = 'https://github.com/baptistelecocq/sentencify'
13
+ spec.homepage = 'https://github.com/tiste/sentencify'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -7,8 +7,6 @@ describe Array do
7
7
  describe '#assert_sentenciable' do
8
8
  it { expect { subject.send(:assert_sentenciable, on: :field) }.to_not raise_error }
9
9
 
10
- it { expect { subject.send(:assert_sentenciable, image: :field) }.to_not raise_error }
11
-
12
10
  it { expect { subject.send(:assert_sentenciable, limit: :field) }.to_not raise_error }
13
11
 
14
12
  it { expect { subject.send(:assert_sentenciable, empty: :field) }.to_not raise_error }
@@ -40,48 +38,84 @@ describe Array do
40
38
  end
41
39
  end
42
40
 
43
- context 'when there is one object' do
44
- subject { [
45
- { name: 'Baptiste Lecocq', login: 'Tiste' }
46
- ] }
41
+ context 'when it contains Active Record or hash objects' do
42
+ context 'when there is one object' do
43
+ subject { [
44
+ { name: 'Baptiste Lecocq', login: 'Tiste' }
45
+ ] }
47
46
 
48
- it 'returns a one element string' do
49
- subject.sentencize(on: :login).should == 'Tiste'
47
+ it 'returns a one element string' do
48
+ subject.sentencize(on: :login).should == 'Tiste'
49
+ end
50
50
  end
51
- end
52
51
 
53
- context 'when there is two objects' do
54
- subject { [
55
- { name: 'Baptiste Lecocq', login: 'Tiste' },
56
- { name: 'Chuck Norris', login: 'Chucky' }
57
- ] }
52
+ context 'when there is two objects' do
53
+ subject { [
54
+ { name: 'Baptiste Lecocq', login: 'Tiste' },
55
+ { name: 'Chuck Norris', login: 'Chucky' }
56
+ ] }
58
57
 
59
- it 'returns a two elements string' do
60
- subject.sentencize(on: :login).should == 'Tiste and Chucky'
58
+ it 'returns a two elements string' do
59
+ subject.sentencize(on: :login).should == 'Tiste and Chucky'
60
+ end
61
61
  end
62
- end
63
62
 
64
- context 'when there is a number of objects less than the limit' do
65
- subject { [
66
- { name: 'Baptiste Lecocq', login: 'Tiste' },
67
- { name: 'Chuck Norris', login: 'Chucky' },
68
- { name: 'Van Damme', login: 'JCVD' }
69
- ] }
63
+ context 'when there is a number of objects less than the limit' do
64
+ subject { [
65
+ { name: 'Baptiste Lecocq', login: 'Tiste' },
66
+ { name: 'Chuck Norris', login: 'Chucky' },
67
+ { name: 'Van Damme', login: 'JCVD' }
68
+ ] }
69
+
70
+ it 'returns a two elements string' do
71
+ subject.sentencize(on: :login).should == 'Tiste, Chucky and JCVD'
72
+ end
73
+ end
74
+
75
+ context 'when there is a number of objects greater than the limit' do
76
+ subject { [
77
+ { name: 'Baptiste Lecocq', login: 'Tiste' },
78
+ { name: 'Chuck Norris', login: 'Chucky' },
79
+ { name: 'Van Damme', login: 'JCVD' }
80
+ ] }
70
81
 
71
- it 'returns a two elements string' do
72
- subject.sentencize(on: :login).should == 'Tiste, Chucky and JCVD'
82
+ it 'returns a two elements string' do
83
+ subject.sentencize(on: :login, limit: 2).should == 'Tiste, Chucky and 1 other'
84
+ end
73
85
  end
74
86
  end
75
87
 
76
- context 'when there is a number of objects greater than the limit' do
77
- subject { [
78
- { name: 'Baptiste Lecocq', login: 'Tiste' },
79
- { name: 'Chuck Norris', login: 'Chucky' },
80
- { name: 'Van Damme', login: 'JCVD' }
81
- ] }
88
+ context 'when it contains strings' do
89
+ context 'when there is one object' do
90
+ subject { ['Tiste'] }
91
+
92
+ it 'returns a one element string' do
93
+ subject.sentencize.should == 'Tiste'
94
+ end
95
+ end
96
+
97
+ context 'when there is two objects' do
98
+ subject { ['Tiste', 'Chucky'] }
99
+
100
+ it 'returns a two elements string' do
101
+ subject.sentencize.should == 'Tiste and Chucky'
102
+ end
103
+ end
104
+
105
+ context 'when there is a number of objects less than the limit' do
106
+ subject { ['Tiste', 'Chucky', 'JCVD'] }
107
+
108
+ it 'returns a two elements string' do
109
+ subject.sentencize.should == 'Tiste, Chucky and JCVD'
110
+ end
111
+ end
112
+
113
+ context 'when there is a number of objects greater than the limit' do
114
+ subject { ['Tiste', 'Chucky', 'JCVD'] }
82
115
 
83
- it 'returns a two elements string' do
84
- subject.sentencize(on: :login, limit: 2).should == 'Tiste, Chucky and 1 other'
116
+ it 'returns a two elements string' do
117
+ subject.sentencize(limit: 2).should == 'Tiste, Chucky and 1 other'
118
+ end
85
119
  end
86
120
  end
87
121
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentencify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Lecocq
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-25 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: With Sentencify, you can create sentences with array of Active Record
@@ -88,12 +88,12 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .coveralls.yml
92
- - .gitignore
93
- - .rspec
94
- - .ruby-gemset
95
- - .ruby-version
96
- - .travis.yml
91
+ - ".coveralls.yml"
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".ruby-gemset"
95
+ - ".ruby-version"
96
+ - ".travis.yml"
97
97
  - CHANGELOG.md
98
98
  - Gemfile
99
99
  - LICENSE.txt
@@ -107,7 +107,7 @@ files:
107
107
  - sentencify.gemspec
108
108
  - spec/sentencify/sentencize_spec.rb
109
109
  - spec/spec_helper.rb
110
- homepage: https://github.com/baptistelecocq/sentencify
110
+ homepage: https://github.com/tiste/sentencify
111
111
  licenses:
112
112
  - MIT
113
113
  metadata: {}
@@ -117,17 +117,17 @@ require_paths:
117
117
  - lib
118
118
  required_ruby_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - ! '>='
120
+ - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ! '>='
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.0.5
130
+ rubygems_version: 2.0.6
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Create sentences with array of Active Record objects