latinverb_imperatives 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f00d56d7ba83df4b432b5fc3b460eca7ee5e4e84
4
+ data.tar.gz: 6adea3456d4463dd51abba802ec1c50595d3331c
5
+ SHA512:
6
+ metadata.gz: 596f3e9041903d786f975c8f7dc6acce8c417f0a093ef8c2bed6a4ed3676a04dd9893b1548910885385778a4dd8f096731329725a71ed26883e46654ed2d5d17
7
+ data.tar.gz: 419a04d513e05526abe8f33f0c4080dc32daac8b81d2eb617402f57cbf79a4f49b0b8092ffd5761513f191f500d3703e5e6253f2e706191c2cda253ca89abe2a
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in latinverb_imperatives.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Steven G. Harms
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # LatinverbImperatives
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'latinverb_imperatives'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install latinverb_imperatives
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/latinverb_imperatives/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'latinverb_imperatives/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "latinverb_imperatives"
8
+ spec.version = LatinverbImperatives::VERSION
9
+ spec.authors = ["Steven G. Harms"]
10
+ spec.email = ["steven.harms@gmail.com"]
11
+ spec.summary = %q{Component for LatinVerb to do imperatives calculation}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "latinverb_irregular_infinitives_retriever"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,26 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class DeponentImperativesHandler < ImperativesHandler
6
+ extend Forwardable
7
+ def_delegators :@proxyVerb, :stem, :present_active_infinitive
8
+ def_delegators :@verb, :original_string
9
+
10
+ def imperatives
11
+ args = [stem, present_active_infinitive]
12
+ Linguistics::Latin::Verb::ImperativeBlock.new(*args, @verb)
13
+ end
14
+
15
+ def stem
16
+ Linguistics::Latin::Verb::LatinVerb::StemDeriver.new(@verb).stem[0..-3]
17
+ end
18
+
19
+ def present_active_infinitive
20
+ Linguistics::Latin::Verb::LatinVerb::DeponentStringDeriver.new(original_string).proxy_string.split(/\s+/)[1]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class ImperativesHandler
6
+ extend Forwardable
7
+
8
+ def_delegators :@verb, :stem, :present_active_infinitive
9
+
10
+ IMPERATIVE_EXCEPTIONS = {
11
+ "ducere" => %w(duc ducite),
12
+ "dicere" => %w(dic dicite),
13
+ "facere" => %w(fac facite),
14
+ "ferre" => %w(fer ferte),
15
+ "nolere" => %w(nolo nolite)
16
+ }
17
+
18
+ def initialize(verb)
19
+ @verb = verb
20
+ end
21
+
22
+ def imperatives
23
+ args = exceptional_imperative? ? calculate_exceptional_imperatives : [stem, present_active_infinitive]
24
+ Linguistics::Latin::Verb::ImperativeBlock.new(*args, @verb)
25
+ end
26
+
27
+ private
28
+
29
+ def exceptional_imperative?
30
+ IMPERATIVE_EXCEPTIONS.has_key?(present_active_infinitive)
31
+ end
32
+
33
+ def calculate_exceptional_imperatives
34
+ IMPERATIVE_EXCEPTIONS[present_active_infinitive]
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,39 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class ImperativesFactory
6
+ extend Forwardable
7
+ def_delegators :@verb, :irregular?, :deponent?, :semideponent?, :original_string
8
+
9
+ def initialize(verb)
10
+ @verb = verb
11
+ end
12
+
13
+ def imperatives
14
+ return irregular if irregular?
15
+ if deponent? || semideponent?
16
+ deponent
17
+ else
18
+ standard
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def irregular
25
+ Linguistics::Latin::Verb::LatinVerb::IrregularImperativesRetriever.new(@verb.original_string).retrieve
26
+ end
27
+
28
+ def deponent
29
+ DeponentImperativesHandler.new(@verb)
30
+ end
31
+
32
+ def standard
33
+ ImperativesHandler.new(@verb)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module LatinverbImperatives
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "forwardable"
2
+ require "latinverb_irregular_infinitives_retriever"
3
+
4
+ require "latinverb_imperatives/version"
5
+ require "latinverb_imperatives/imperatives_factory/imperatives_handler"
6
+ require "latinverb_imperatives/imperatives_factory/deponent_imperatives_handler"
7
+ require "latinverb_imperatives/imperatives_factory"
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: latinverb_imperatives
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Steven G. Harms
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: latinverb_irregular_infinitives_retriever
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - steven.harms@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - latinverb_imperatives.gemspec
68
+ - lib/latinverb_imperatives.rb
69
+ - lib/latinverb_imperatives/imperatives_factory.rb
70
+ - lib/latinverb_imperatives/imperatives_factory/deponent_imperatives_handler.rb
71
+ - lib/latinverb_imperatives/imperatives_factory/imperatives_handler.rb
72
+ - lib/latinverb_imperatives/version.rb
73
+ homepage: ''
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Component for LatinVerb to do imperatives calculation
97
+ test_files: []