random_text 0.0.6.3 → 0.0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,17 @@
1
1
  module RandomText
2
2
  class RandomText
3
3
  def initialize(text)
4
- @words = RandomStrings.new(text.scan(/\w{3,}/).collect{ |w| w.mb_chars.downcase.to_s }.reject{ |w| w =~ /^[0-9]/ }.uniq.map(&:mb_chars))
5
- @sentences = RandomStrings.new(text.split(/[\r\n]+/).map(&:strip).compact.delete_if(&:blank?).uniq)
4
+ @words = RandomStrings.new(text.scan(/\w{3,}/).
5
+ collect{ |w| chars(w).downcase.to_s }.
6
+ reject{ |w| w =~ /^[0-9]/ }.
7
+ uniq.map{ |w| chars(w) })
8
+ @sentences = RandomStrings.new(text.split(/[\r\n]+/).
9
+ map(&:strip).compact.
10
+ delete_if(&:blank?).uniq)
11
+ end
12
+
13
+ def chars(s)
14
+ s.respond_to?(:mb_chars) ? s.mb_chars : s.chars
6
15
  end
7
16
 
8
17
  def word
data/random_text.gemspec CHANGED
@@ -2,21 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{random_text}
5
- s.version = "0.0.6.3"
5
+ s.version = "0.0.6.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["toy"]
9
- s.date = %q{2009-05-02}
9
+ s.date = %q{2009-06-03}
10
10
  s.description = %q{A library to generate random strings.}
11
11
  s.email = %q{}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/random_text/random_strings.rb", "lib/random_text/random_text.rb", "lib/random_text.rb", "README.rdoc", "tasks/rspec.rake"]
13
13
  s.files = ["CHANGELOG", "lib/random_text/random_strings.rb", "lib/random_text/random_text.rb", "lib/random_text.rb", "Rakefile", "README.rdoc", "resources/lorem.txt", "resources/vesna.txt", "script/console", "script/destroy", "script/generate", "spec/random_text/random_string_spec.rb", "spec/random_text/random_text_spec.rb", "spec/random_text_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake", "Manifest", "random_text.gemspec"]
14
- s.has_rdoc = true
15
14
  s.homepage = %q{}
16
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Random_text", "--main", "README.rdoc"]
17
16
  s.require_paths = ["lib"]
18
17
  s.rubyforge_project = %q{random_text}
19
- s.rubygems_version = %q{1.3.2}
18
+ s.rubygems_version = %q{1.3.3}
20
19
  s.summary = %q{A library to generate random strings.}
21
20
 
22
21
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.3
4
+ version: 0.0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-02 00:00:00 +04:00
12
+ date: 2009-06-03 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements: []
85
85
 
86
86
  rubyforge_project: random_text
87
- rubygems_version: 1.3.2
87
+ rubygems_version: 1.3.3
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: A library to generate random strings.