learn_words 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/README.rdoc CHANGED
@@ -4,7 +4,7 @@
4
4
  === Installation
5
5
  Installation process is quite simple (notice, that ruby could be already installed)
6
6
 
7
- * install ruby from http://www.ruby-lang.org/en/downloads/
7
+ * install ruby from http://www.ruby-lang.org/en/downloads
8
8
 
9
9
  * install rubygems from http://rubygems.org/pages/download
10
10
 
@@ -15,7 +15,7 @@
15
15
  === Words file
16
16
  To use this application you need to have a file in a special format:
17
17
 
18
- * any number of lines with foreign word and it's translation separated by <tt><Tab></tt>
18
+ * any number of lines with foreign word and it's translation separated by <tt><Tab></tt> or two or more spaces
19
19
 
20
20
  * if there are more than one variant for foreign word, separate them by "/"
21
21
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('learn_words', '0.1.1') do |p|
5
+ Echoe.new('learn_words', '0.1.2') do |p|
6
6
  p.description = "Simple script for learning foreign language words"
7
7
  p.url = "http://github.com/cypok/learn_words"
8
8
  p.author = "Vladimir Parfinenko"
data/learn_words.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{learn_words}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Vladimir Parfinenko"]
9
9
  s.cert_chain = ["/Users/cypok/.gem/gem-public_cert.pem"]
10
- s.date = %q{2010-10-09}
10
+ s.date = %q{2010-10-10}
11
11
  s.default_executable = %q{learn_words}
12
12
  s.description = %q{Simple script for learning foreign language words}
13
13
  s.email = %q{vladimir.parfinenko@gmail.com}
data/lib/learn_words.rb CHANGED
@@ -103,9 +103,14 @@ class LearnWords
103
103
  begin
104
104
  open(words_file) do |file|
105
105
  file.lines.each do |line|
106
- next if line.strip.empty? # pass blank lines
107
- parts = line.split( "\t" ).map{ |x| x.strip }.delete_if{ |x| x.empty? }
108
- words << Word.new( parts[1], parts[0], limit ) unless line.start_with? '#'
106
+ # pass blank lines
107
+ next if line.strip.empty? or line.strip.start_with? '#'
108
+
109
+ # split into two parts by first tab or double space
110
+ parts = line.split( /\t| {2,}/, 2 ).map(&:strip)
111
+ next if parts.count < 2
112
+
113
+ words << Word.new( parts[1], parts[0], limit )
109
114
  end
110
115
  end
111
116
  rescue Exception => e
@@ -135,7 +140,7 @@ class LearnWords
135
140
  say %{ <%= color(' Learn Words ! ', GREEN+UNDERLINE) %>}
136
141
  say %{ <%= color('made by Vladimir Parfinenko aka cypok', GREEN) %>}
137
142
  say %{ <%= color(' some fixes by Ivan Novikov aka NIA ', GREEN) %>}
138
- say %{ <%= color(' version 0.1.1 ', GREEN) %>}
143
+ say %{ <%= color(' version 0.1.2 ', GREEN) %>}
139
144
  STDOUT.write "\n"
140
145
  say %{Note: if there are more than one variant,}
141
146
  say %{separate them by "/" or enter one by one}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn_words
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vladimir Parfinenko
@@ -36,7 +36,7 @@ cert_chain:
36
36
  78F0qvtLjR0DAnN6uYs98PR+jHE+0ckLX3D9sw==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2010-10-09 00:00:00 +07:00
39
+ date: 2010-10-10 00:00:00 +07:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file