wookie-translator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +9 -0
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/lib/wookie.rb +1 -1
- data/lib/wookie/cli.rb +3 -3
- data/lib/wookie/dialects/simple.rb +1 -1
- data/lib/wookie/translator.rb +1 -1
- data/spec/wookie/identity_dialect_spec.rb +1 -1
- data/spec/wookie/translator_spec.rb +2 -2
- data/wookie-translator.gemspec +1 -0
- metadata +17 -5
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/wookie.rb
CHANGED
data/lib/wookie/cli.rb
CHANGED
@@ -42,8 +42,8 @@ class Wookie::CLI
|
|
42
42
|
def initialize(argv)
|
43
43
|
@argv = argv || ARGV
|
44
44
|
@options = {
|
45
|
-
use_stdin
|
46
|
-
dialect
|
45
|
+
:use_stdin => false,
|
46
|
+
:dialect => :simple
|
47
47
|
}
|
48
48
|
OptionParser.new do |opts|
|
49
49
|
opts.banner = "Usage: wookie [options] string\n wookie [options] -"
|
@@ -83,7 +83,7 @@ class Wookie::CLI
|
|
83
83
|
else
|
84
84
|
@argv.join(' ')
|
85
85
|
end
|
86
|
-
t = Wookie::Translator.new(dialect
|
86
|
+
t = Wookie::Translator.new(:dialect => dialect)
|
87
87
|
puts t.send(@options[:translation], string)
|
88
88
|
end
|
89
89
|
end
|
@@ -17,7 +17,7 @@ module Wookie::Dialect
|
|
17
17
|
}.freeze
|
18
18
|
|
19
19
|
# A short code is defined by a length of 1 of a lookup value.
|
20
|
-
SHORT_CODES = LOOKUP.map{|_,v| v if v.length == 1 }.compact.join
|
20
|
+
SHORT_CODES = LOOKUP.map{|_,v| v if v.length == 1 }.compact.sort.join
|
21
21
|
|
22
22
|
# Translates an english string to wookiespeack.
|
23
23
|
#
|
data/lib/wookie/translator.rb
CHANGED
@@ -6,7 +6,7 @@ class Wookie::Translator
|
|
6
6
|
# Contructor, defines the dialect ({Wookie::Dialect::Simple} by default).
|
7
7
|
# @param [Hash] options The instance options.
|
8
8
|
# @option options [#to_wookie,#from_wookie] :dialect A wookie dialect.
|
9
|
-
def initialize(options={ dialect
|
9
|
+
def initialize(options={ :dialect => Wookie::Dialect::Simple })
|
10
10
|
@dialect = options[:dialect].new
|
11
11
|
end
|
12
12
|
|
@@ -8,7 +8,7 @@ end
|
|
8
8
|
|
9
9
|
describe Wookie::Translator do
|
10
10
|
before do
|
11
|
-
@t = Wookie::Translator.new(dialect
|
11
|
+
@t = Wookie::Translator.new(:dialect => IdentityDialect)
|
12
12
|
@english = 'enter your text here!'
|
13
13
|
@wookie = 'wowhaoworc rooohurc aowokao acworcwo!'
|
14
14
|
end
|
@@ -14,13 +14,13 @@ describe Wookie::Translator do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should translate with the simple default dialect (hash form)" do
|
17
|
-
t = Wookie::Translator.new dialect
|
17
|
+
t = Wookie::Translator.new :dialect => Wookie::Dialect::Simple
|
18
18
|
t.to_wookie(@english).should eq(@wookie)
|
19
19
|
t.from_wookie(@wookie).should eq(@english)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should raise a NotImplementedError if using an incomplete dialect" do
|
23
|
-
t = Wookie::Translator.new dialect
|
23
|
+
t = Wookie::Translator.new :dialect => Wookie::Dialect::Base
|
24
24
|
expect {
|
25
25
|
t.to_wookie(@english).should eq(@wookie)
|
26
26
|
}.to raise_error(NotImplementedError)
|
data/wookie-translator.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wookie-translator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,9 +13,20 @@ bindir: bin
|
|
13
13
|
cert_chain: []
|
14
14
|
date: 2012-03-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rake
|
18
|
+
requirement: &15335760 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.2
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *15335760
|
16
27
|
- !ruby/object:Gem::Dependency
|
17
28
|
name: rspec
|
18
|
-
requirement: &
|
29
|
+
requirement: &15335280 !ruby/object:Gem::Requirement
|
19
30
|
none: false
|
20
31
|
requirements:
|
21
32
|
- - ~>
|
@@ -23,7 +34,7 @@ dependencies:
|
|
23
34
|
version: '2.0'
|
24
35
|
type: :development
|
25
36
|
prerelease: false
|
26
|
-
version_requirements: *
|
37
|
+
version_requirements: *15335280
|
27
38
|
description: Translates an english string to wookie speak and vice versa.
|
28
39
|
email:
|
29
40
|
- wookie-translator@dmke.org
|
@@ -36,6 +47,7 @@ files:
|
|
36
47
|
- .rbenv-gemsets
|
37
48
|
- .rbenv-version
|
38
49
|
- .rspec
|
50
|
+
- .travis.yml
|
39
51
|
- .yardopts
|
40
52
|
- Gemfile
|
41
53
|
- README.md
|
@@ -65,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
77
|
version: '0'
|
66
78
|
segments:
|
67
79
|
- 0
|
68
|
-
hash:
|
80
|
+
hash: 1711409271721891242
|
69
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
82
|
none: false
|
71
83
|
requirements:
|
@@ -74,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
86
|
version: '0'
|
75
87
|
segments:
|
76
88
|
- 0
|
77
|
-
hash:
|
89
|
+
hash: 1711409271721891242
|
78
90
|
requirements: []
|
79
91
|
rubyforge_project:
|
80
92
|
rubygems_version: 1.8.11
|