cat_ipsum 0.1.1 → 0.2.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +23 -9
- data/lib/cat_ipsum/cat_actions.rb +3 -2
- data/lib/cat_ipsum/random.rb +30 -0
- data/lib/cat_ipsum/version.rb +1 -1
- data/lib/cat_ipsum.rb +2 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81ba3d9e4617f1b55cca3651f877cee50e4c62311ce878a92f3f3213058fd25f
|
4
|
+
data.tar.gz: 3c42b4485d7f3cd3b38130f56f01e5541d2f5b90dd24d21a00371de6d233d367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffa0b95efb2e3389027a75bdb5696cec03629f47a82096aabdc9f01ec51ab3ef4af66a5f4d7efb5ff29ddea68ff9c93cf5154c420c1fc89ab6c05427d0ad3cdb
|
7
|
+
data.tar.gz: 39129860d8991e0a0dd5792e89c57706d9877575e65fbeb0611d21d7b23e973cfa98adae7e8707f135b3b0cbcc425b4d3cee71bc2a57b61569f2ecefba89d3cc
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# CatIpsum
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This gem generates fake text based on cats' typical activities. Just use it like another Lorem Ipsum version.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,14 +20,30 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
#### Methods
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
CatIpsum.sentence
|
27
|
+
# => "Swat at dog, inspect anything brought into the house, play time"
|
26
28
|
|
27
|
-
|
29
|
+
CatIpsum.paragraph
|
30
|
+
# => "Shake treat bag, chase imaginary bugs, why must they do that. Nap all day, stand in doorway, yawn so much. Play time, chew ipad power cord, ignore the human. Need to chase tail, hide when guests come over, throwup on your pillow. Hate dog, mark territory, go crazy"
|
31
|
+
```
|
28
32
|
|
29
|
-
|
33
|
+
`CatIpsum.sentences` and `CatIpsum.paragraphs` returns arrays of their original methods.
|
30
34
|
|
31
|
-
|
35
|
+
`CatIpsum.phrase` and `CatIpsum.phrases` are aliases to `CatIpsum.sentence` and `CatIpsum.sentence`.
|
32
36
|
|
33
|
-
|
37
|
+
#### Working with randomizing seeds
|
34
38
|
|
35
|
-
|
39
|
+
You can specify your seed to generate repeatable data. Also, seed can be reseted by `CatIpsum.reset!` method.
|
40
|
+
Example:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
CatIpsum.sentence
|
44
|
+
# => "Leave hair everywhere, shake treat bag, missing until dinner time"
|
45
|
+
CatIpsum::Random.reset!
|
46
|
+
# => true
|
47
|
+
CatIpsum.sentence
|
48
|
+
# => "Leave hair everywhere, shake treat bag, missing until dinner time"
|
49
|
+
```
|
@@ -14,7 +14,7 @@ module CatIpsum
|
|
14
14
|
'destroy couch',
|
15
15
|
'find something else more interesting',
|
16
16
|
'flop over',
|
17
|
-
'
|
17
|
+
'get on the high shelf',
|
18
18
|
'go crazy',
|
19
19
|
'hate dog',
|
20
20
|
'hide when guests come over',
|
@@ -29,7 +29,7 @@ module CatIpsum
|
|
29
29
|
'mark territory',
|
30
30
|
'missing until dinner time',
|
31
31
|
'nap all day',
|
32
|
-
'
|
32
|
+
'need to chase tail',
|
33
33
|
'play time',
|
34
34
|
'purr',
|
35
35
|
'rub face on everything',
|
@@ -39,6 +39,7 @@ module CatIpsum
|
|
39
39
|
'stand in doorway',
|
40
40
|
'stand in front of the computer screen',
|
41
41
|
'stare at ceiling',
|
42
|
+
'start playing with something lying on the floor',
|
42
43
|
'stick butt in face',
|
43
44
|
'stretch',
|
44
45
|
'sun bathe',
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module CatIpsum
|
2
|
+
class Random
|
3
|
+
def self.seed
|
4
|
+
@seed ||= ::Random.new_seed
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.seed=(value)
|
8
|
+
@seed = value
|
9
|
+
reset!
|
10
|
+
value
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.reset!
|
14
|
+
@randomizer = randomize
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.randomizer
|
19
|
+
@randomizer ||= randomize
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.randomize
|
23
|
+
::Random.new(seed)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.sample(array)
|
27
|
+
array.shuffle(random: randomizer).take(3)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/cat_ipsum/version.rb
CHANGED
data/lib/cat_ipsum.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
require 'cat_ipsum/version'
|
2
2
|
require 'cat_ipsum/cat_actions'
|
3
|
+
require 'cat_ipsum/random'
|
3
4
|
|
4
5
|
module CatIpsum
|
5
6
|
extend self
|
6
7
|
|
7
8
|
def sentence
|
8
|
-
|
9
|
-
rand(1..5).times do
|
10
|
-
result << CAT_ACTIONS.sample
|
11
|
-
end
|
12
|
-
result.join(', ').capitalize
|
9
|
+
Random.sample(CAT_ACTIONS.dup).join(', ').capitalize
|
13
10
|
end
|
14
11
|
|
15
12
|
alias phrase sentence
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cat_ipsum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vsevolod Voloshyn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- cat_ipsum.gemspec
|
100
100
|
- lib/cat_ipsum.rb
|
101
101
|
- lib/cat_ipsum/cat_actions.rb
|
102
|
+
- lib/cat_ipsum/random.rb
|
102
103
|
- lib/cat_ipsum/version.rb
|
103
104
|
homepage: https://github.com/Volosh1n/cat_ipsum
|
104
105
|
licenses: []
|