random-word 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/random_word.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'set'
2
2
  require 'pathname'
3
+ require 'json'
3
4
 
4
5
  # Provides random, non-repeating enumerators of a large list of
5
6
  # english words. For example"
@@ -72,14 +73,14 @@ module RandomWord
72
73
 
73
74
  # @return [Enumerator] Random noun enumerator
74
75
  def nouns(opts = {})
75
- @nouns ||= enumerator(load_word_list("nouns.dat"), exclude_list)
76
+ @nouns ||= enumerator(load_word_list("nouns.json"), exclude_list)
76
77
  word_list.set_constraints(opts)
77
78
  @nouns
78
79
  end
79
80
 
80
81
  # @return [Enumerator] Random adjective enumerator
81
82
  def adjs(opts = {})
82
- @adjs ||= enumerator(load_word_list("adjs.dat"), exclude_list)
83
+ @adjs ||= enumerator(load_word_list("adjs.json"), exclude_list)
83
84
  word_list.set_constraints(opts)
84
85
  @adjs
85
86
  end
@@ -107,8 +108,8 @@ module RandomWord
107
108
  protected
108
109
 
109
110
  def load_word_list(name)
110
- data_root = Pathname(File.dirname(__FILE__)) + "../data"
111
- File.open(data_root + name){|f| Marshal.load(f)}
111
+ filename = File.join Pathname(File.dirname(__FILE__)), "../data", name
112
+ JSON.parse(File.read(filename))
112
113
  end
113
114
  end
114
115
  end
@@ -1,3 +1,3 @@
1
1
  module RandomWord
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random-word
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-04-21 00:00:00.000000000 Z
12
+ date: 2017-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -100,8 +100,8 @@ files:
100
100
  - LICENSE.txt
101
101
  - README.markdown
102
102
  - Rakefile
103
- - data/adjs.dat
104
- - data/nouns.dat
103
+ - data/adjs.json
104
+ - data/nouns.json
105
105
  - lib/random-word.rb
106
106
  - lib/random_word.rb
107
107
  - lib/random_word/version.rb
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.6.11
130
+ rubygems_version: 2.6.13
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Pick random words for factory data
data/data/adjs.dat DELETED
Binary file
data/data/nouns.dat DELETED
Binary file