tracinho 0.1.1 → 0.1.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: 9c70051cae7ac844bab71d7b3f6edad29e7202cb
4
- data.tar.gz: f678f3b6464af23f130cdb4607940ea624dd6507
3
+ metadata.gz: 6ac4ff2efca57bb861585d8e88b14959e4b743d9
4
+ data.tar.gz: e470af0a0a0ea736f115612e68856154b547e7f6
5
5
  SHA512:
6
- metadata.gz: 2b6ca80265f4ae7d337cadfd724e44bf5a7a365df1fe37f279ef99d0017defffc0ecb76351960dc6084129fe5afa77f7998090e490d5aeb64efa9ad3b5903281
7
- data.tar.gz: 3cff9737f23c7df6d47dce9158d522c9135db61f6f7b0daf8fc6cd13340befdc93e56cd42c55b9f2df4e82b5eb8d33de1712e65391d1a3b5752e2ab62586904c
6
+ metadata.gz: ca4ce4573245f60ae3eda72dfac119472af947c6d3458514685dc1efeccd50f140d6a0d495a56a2d5bcb50801d71184cd620ef78617d6456727e36b4a27af845
7
+ data.tar.gz: 61531fd654f16be289f7d2ece845cacd77552602174eeb8052083621a604fb9712dc7c22e275615aa796b3ed47cfd342966a2462903db82c8a43ba652fe81808
data/.rubocop.yml CHANGED
@@ -1,2 +1,15 @@
1
1
  Metrics/LineLength:
2
2
  Max: 100
3
+
4
+ # We have a lot of portuguese examples in the comments so...
5
+ Style/AsciiComments:
6
+ Enabled: false
7
+
8
+ # The default (10) is too litle
9
+ Metrics/MethodLength:
10
+ Max: 15
11
+
12
+ # Blocks in spec files get big
13
+ Metrics/BlockLength:
14
+ Exclude:
15
+ - 'spec/**'
data/.travis.yml CHANGED
@@ -1,8 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.0
4
- - 2.1.3
5
- - 2.2.0
6
- - 2.2.2
3
+ - 2.4.2
7
4
  script: bundle exec rspec
8
5
  sudo: false
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in tracinho.gemspec
data/Gemfile.lock CHANGED
@@ -1,66 +1,70 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tracinho (0.1.1)
4
+ tracinho (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.1.0)
10
- astrolabe (1.3.1)
11
- parser (~> 2.2)
12
- coderay (1.1.0)
13
- diff-lcs (1.2.5)
9
+ ast (2.3.0)
10
+ byebug (9.1.0)
11
+ coderay (1.1.2)
12
+ diff-lcs (1.3)
14
13
  docile (1.1.5)
15
- json (1.8.3)
16
- method_source (0.8.2)
17
- parser (2.2.3.0)
18
- ast (>= 1.1, < 3.0)
14
+ json (2.1.0)
15
+ method_source (0.9.0)
16
+ parallel (1.12.0)
17
+ parser (2.4.0.0)
18
+ ast (~> 2.2)
19
19
  powerpack (0.1.1)
20
- pry (0.10.3)
20
+ pry (0.11.2)
21
21
  coderay (~> 1.1.0)
22
- method_source (~> 0.8.1)
23
- slop (~> 3.4)
24
- rainbow (2.0.0)
25
- rake (10.4.2)
26
- rspec (3.3.0)
27
- rspec-core (~> 3.3.0)
28
- rspec-expectations (~> 3.3.0)
29
- rspec-mocks (~> 3.3.0)
30
- rspec-core (3.3.2)
31
- rspec-support (~> 3.3.0)
32
- rspec-expectations (3.3.1)
22
+ method_source (~> 0.9.0)
23
+ pry-byebug (3.5.0)
24
+ byebug (~> 9.1)
25
+ pry (~> 0.10)
26
+ rainbow (2.2.2)
27
+ rake
28
+ rake (12.1.0)
29
+ rspec (3.7.0)
30
+ rspec-core (~> 3.7.0)
31
+ rspec-expectations (~> 3.7.0)
32
+ rspec-mocks (~> 3.7.0)
33
+ rspec-core (3.7.0)
34
+ rspec-support (~> 3.7.0)
35
+ rspec-expectations (3.7.0)
33
36
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.3.0)
35
- rspec-mocks (3.3.2)
37
+ rspec-support (~> 3.7.0)
38
+ rspec-mocks (3.7.0)
36
39
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.3.0)
38
- rspec-support (3.3.0)
39
- rubocop (0.35.0)
40
- astrolabe (~> 1.3)
41
- parser (>= 2.2.3.0, < 3.0)
40
+ rspec-support (~> 3.7.0)
41
+ rspec-support (3.7.0)
42
+ rubocop (0.51.0)
43
+ parallel (~> 1.10)
44
+ parser (>= 2.3.3.1, < 3.0)
42
45
  powerpack (~> 0.1)
43
- rainbow (>= 1.99.1, < 3.0)
46
+ rainbow (>= 2.2.2, < 3.0)
44
47
  ruby-progressbar (~> 1.7)
45
- ruby-progressbar (1.7.5)
46
- simplecov (0.10.0)
48
+ unicode-display_width (~> 1.0, >= 1.0.1)
49
+ ruby-progressbar (1.9.0)
50
+ simplecov (0.15.1)
47
51
  docile (~> 1.1.0)
48
- json (~> 1.8)
52
+ json (>= 1.8, < 3)
49
53
  simplecov-html (~> 0.10.0)
50
- simplecov-html (0.10.0)
51
- slop (3.6.0)
54
+ simplecov-html (0.10.2)
55
+ unicode-display_width (1.3.0)
52
56
 
53
57
  PLATFORMS
54
58
  ruby
55
59
 
56
60
  DEPENDENCIES
57
- bundler (~> 1.10)
58
- pry (~> 0.10)
59
- rake (~> 10.4)
60
- rspec (~> 3.3)
61
- rubocop (~> 0.35)
62
- simplecov (~> 0.10)
61
+ bundler
62
+ pry-byebug
63
+ rake
64
+ rspec
65
+ rubocop
66
+ simplecov
63
67
  tracinho!
64
68
 
65
69
  BUNDLED WITH
66
- 1.10.6
70
+ 1.15.4
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ #!/usr/bin/env ruby
3
+
4
+ require 'bundler/setup'
5
+ require 'tracinho'
6
+
7
+ include Tracinho
8
+
9
+ require 'pry'
10
+ Pry.start
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tracinho
2
4
  # ComplementBuilder converts words with dash in the version without it and vice-versa.
3
5
  class ComplementBuilder
@@ -21,15 +23,15 @@ module Tracinho
21
23
  private
22
24
 
23
25
  def remove_dash(text)
24
- text.match(/\-se$/) ? text.tr('-', 's') : text.delete('-')
26
+ text.match?(/\-se$/) ? text.dup.tr('-', 's') : text.dup.delete('-')
25
27
  end
26
28
 
27
29
  def add_dash(text)
28
30
  case text
29
31
  when /os$/
30
- text.insert(-4, '-')
32
+ text.dup.insert(-4, '-')
31
33
  else
32
- text.insert(-3, '-')
34
+ text.dup.insert(-3, '-')
33
35
  end
34
36
  end
35
37
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This gem converts words with dash in the version without it and vice-versa. It also gets the verb
2
4
  # name from a word and gives the full grammar classification of the verb.
3
5
  module Tracinho
4
- VERSION = '0.1.1'
6
+ VERSION = '0.1.2'
5
7
  end
data/lib/tracinho/word.rb CHANGED
@@ -1,13 +1,32 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tracinho
4
+ # Word is the class that represents a word (duh!). It includes some methods to quickly get the
5
+ # complement word or the classification.
6
+ #
7
+ # Example:
8
+ #
9
+ # word = Tracinho::Word.new('comeste')
10
+ #
11
+ # word.hyphenated?
12
+ # # => false
13
+ #
14
+ # word.complement
15
+ # # => "comes-te"
16
+ #
17
+ # word.grammar_class
18
+ # # => "Segunda pessoa do singular do pretérito perfeito do indicativo do verbo comer."
2
19
  class Word
3
20
  def initialize(text)
4
21
  @text = text
5
22
  end
6
23
 
24
+ # Returns true if the word as a hyphen (the '-' character) or false otherwise.
7
25
  def hyphenated?
8
26
  @text.include?('-')
9
27
  end
10
28
 
29
+ # Returns the complement of the word.
11
30
  def complement
12
31
  ComplementBuilder.new(self).build
13
32
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tracinho
2
4
  # WordClassifier is the responsible for classifying a word. It gives the verb, the verb tense and
3
5
  # the full classification of a Word.
@@ -28,7 +30,7 @@ module Tracinho
28
30
  #
29
31
  # classifier = Tracinho::WordClassifier.new(word)
30
32
  # classifier.full_classification
31
- # # => "Conjugação pronominal reflexa da segunda pessoa do presente do indicativo do verbo matar."
33
+ # # => "Conjugação pronominal reflexa da segunda pessoa do presente do indicat..."
32
34
  def full_classification
33
35
  case @word.to_s
34
36
  when /ste$/
data/lib/tracinho.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tracinho/version'
2
4
  require 'tracinho/complement_builder'
3
5
  require 'tracinho/word'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ComplementBuilder do
4
- let(:hyphenated) { %w(passa-mos cala-te matas-te conhecer-te morde-mos mata-te) }
5
- let(:not_hyphenated) { %w(passamos calate mataste conhecerte mordemos matate) }
6
+ let(:hyphenated) { %w[passa-mos cala-te matas-te conhecer-te morde-mos mata-te] }
7
+ let(:not_hyphenated) { %w[passamos calate mataste conhecerte mordemos matate] }
6
8
 
7
9
  describe '#build' do
8
10
  it 'complements hyphenated words correctly' do
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
 
3
5
  SimpleCov.start do
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe WordClassifier do
4
6
  describe 'verb' do
5
7
  let(:regular_words) do
6
- %w(bebemos comesse mijaste cagou-se passa-mos cala-te matas-te conhecer-te morde-mos mata-te)
8
+ %w[bebemos comesse mijaste cagou-se passa-mos cala-te matas-te conhecer-te morde-mos mata-te]
7
9
  end
8
10
 
9
11
  let(:regular_verbs) do
10
- %w(beber comer mijar cagar passar calar matar conhecer morder matar)
12
+ %w[beber comer mijar cagar passar calar matar conhecer morder matar]
11
13
  end
12
14
 
13
15
  let(:irregular_words) do
14
- %w(vamos somos fomos)
16
+ %w[vamos somos fomos]
15
17
  end
16
18
 
17
19
  let(:irregular_verbs) do
18
- %w(ir ser ser)
20
+ %w[ir ser ser]
19
21
  end
20
22
 
21
23
  context 'for regular verbs' do
@@ -51,7 +53,7 @@ describe WordClassifier do
51
53
  ]
52
54
  end
53
55
 
54
- %w(mijaste bebesse conhecemos busca-mos).each_with_index do |word, index|
56
+ %w[mijaste bebesse conhecemos busca-mos].each_with_index do |word, index|
55
57
  it "correctly returns the full classification of the word '#{word}'" do
56
58
  classifier = described_class.new(Word.new(word))
57
59
 
data/spec/word_spec.rb CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Word do
4
- let(:hyphenated) { %w(passa-mos cala-te matas-te conhecer-te morde-mos mata-te) }
5
- let(:not_hyphenated) { %w(passamos calate mataste conhecerte mordemos matate) }
6
+ let(:hyphenated) { %w[passa-mos cala-te matas-te conhecer-te morde-mos mata-te] }
7
+ let(:not_hyphenated) { %w[passamos calate mataste conhecerte mordemos matate] }
6
8
 
7
9
  describe '#hyphenated?' do
8
10
  it 'returns true if the word has a hyphen' do
data/tracinho.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('../lib', __FILE__)
2
4
 
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -21,10 +23,10 @@ Gem::Specification.new do |spec|
21
23
  spec.test_files = spec.files.grep(%r{^spec/})
22
24
  spec.require_paths = ['lib']
23
25
 
24
- spec.add_development_dependency 'bundler', '~> 1.10'
25
- spec.add_development_dependency 'rake', '~> 10.4'
26
- spec.add_development_dependency 'pry', '~> 0.10'
27
- spec.add_development_dependency 'rubocop', '~> 0.35'
28
- spec.add_development_dependency 'rspec', '~> 3.3'
29
- spec.add_development_dependency 'simplecov', '~> 0.10'
26
+ spec.add_development_dependency 'bundler'
27
+ spec.add_development_dependency 'pry-byebug'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'rspec'
30
+ spec.add_development_dependency 'rubocop'
31
+ spec.add_development_dependency 'simplecov'
30
32
  end
metadata CHANGED
@@ -1,106 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracinho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-07 00:00:00.000000000 Z
11
+ date: 2017-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '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: '1.10'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: pry-byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.4'
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
- version: '10.4'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: pry
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.10'
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
- version: '0.10'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rubocop
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.35'
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
- version: '0.35'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.3'
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
- version: '3.3'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0.10'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0.10'
96
+ version: '0'
97
97
  description: |-
98
98
  This gem converts words with dash in the version without it and vice-versa.
99
99
  It also gets the verb name from a word and gives the full grammar
100
100
  classification of the verb.
101
101
  email:
102
102
  - oterosantos@gmail.com
103
- executables: []
103
+ executables:
104
+ - console
104
105
  extensions: []
105
106
  extra_rdoc_files: []
106
107
  files:
@@ -113,6 +114,7 @@ files:
113
114
  - LICENSE
114
115
  - README.md
115
116
  - Rakefile
117
+ - bin/console
116
118
  - lib/tracinho.rb
117
119
  - lib/tracinho/complement_builder.rb
118
120
  - lib/tracinho/version.rb
@@ -143,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
145
  version: '0'
144
146
  requirements: []
145
147
  rubyforge_project:
146
- rubygems_version: 2.4.5.1
148
+ rubygems_version: 2.6.13
147
149
  signing_key:
148
150
  specification_version: 4
149
151
  summary: Tracinho.com gem.