dingo 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +16 -0
  3. data/dingo.txt +173 -0
  4. data/lib/dingo.rb +54 -0
  5. data/test/dingo_test.rb +33 -0
  6. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a7f983fb523031718004d5544a0dfa4941331385
4
+ data.tar.gz: 727553eba63625532283041582532d99b6bdbeb4
5
+ SHA512:
6
+ metadata.gz: 9c518370385d9e38992565cec775bdea3a74edd4586960d701f26818c142f5d9849def652ea04e8efa1be3ff638cc9b6fdc678b1b8764883242a479fec625107
7
+ data.tar.gz: 074cb8b77a5b2ffda651fbd6cffb639a4742a35cefb85948c8a9f50dcd7adc3e31f1a825ce1f62c3fade9ab004922a929e4e6d758efc55b1e06afba2f04c744b
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ Dingo
2
+ --
3
+
4
+ Dingo generates copy. Because you're a real aussie and are too lazy to write
5
+ your own.
6
+
7
+ ```
8
+ Dingo.words.take(4)
9
+ => ["mateship", "Woolies", "marbo", "sicky"]
10
+
11
+ Dingo.sentences.take(4)
12
+ => ["Harsh but fair skippy sizzler dog on the tucker box straight to the pool room sting ray.", "Advance australia fair vegemite one hand one bounce herald sun little people riding horses reversing the ute one handed.", "Shane crawford wranga humphrey b bear tinneys grant thomas marbo.", "Crocodile dundee sizzler gary lions thorpey gillie bondai."]
13
+
14
+ Dingo.paragraphs.take(1)
15
+ => ["Uluru cathy freeman warney sizzler pavlova burke & wills. Bondai australian gold wayne carey paul kelly harsh but fair straight to the pool room. Skin cancer dog on the tucker box flip flops darl you're terrible muriel canary yellow. Having a punt mateship v8 sportsbet telstra spin bowling."]
16
+ ```
data/dingo.txt ADDED
@@ -0,0 +1,173 @@
1
+ Darrel Summers
2
+ Herald Sun
3
+ sausage roll
4
+ footy
5
+ speccy
6
+ Ernie Dingo
7
+ Bruce Mcavaney
8
+ Cathy Freeman
9
+ mate
10
+ cobber
11
+ 4 and 20
12
+ true blue
13
+ mateship
14
+ quintesentially australian
15
+ Julia Gillard
16
+ Mad Monk
17
+ Bob Hawk
18
+ Warney
19
+ Gillie
20
+ Merv Hughes
21
+ Richie Benaud
22
+ Australian gold
23
+ Canary yellow
24
+ green and gold
25
+ Dawn Fraser
26
+ Thorpey
27
+ VB
28
+ XXXX
29
+ holding the ball
30
+ in the back!
31
+ snags
32
+ Barbey
33
+ Boat People
34
+ Southern Cross
35
+ Bondai
36
+ Great Southern Land
37
+ Land down under
38
+ Ned Kelly
39
+ Paul Kelly
40
+ dog on the tucker box
41
+ 'burbs
42
+ Holden
43
+ Ford
44
+ bogan
45
+ ACDC
46
+ un-australian
47
+ swing the willow at it
48
+ Lleyton Hewitt
49
+ Pat Rafter
50
+ Bonds
51
+ Vegemite
52
+ sicky
53
+ Pharlap
54
+ Sam Newman
55
+ Eddie MacGuire
56
+ Grant Thomas
57
+ Great Australian Hero
58
+ too right
59
+ Strewth!
60
+ Agro
61
+ The Nullabor
62
+ Uluru
63
+ Woolies
64
+ Wallaby
65
+ wranga
66
+ tomato sauce
67
+ heinz
68
+ mullet
69
+ Kath & Kim
70
+ Rove
71
+ Adam Hills
72
+ harsh but fair
73
+ yeah nah
74
+ reversing the ute one handed
75
+ tinneys
76
+ Acca Dacca
77
+ how goods that?
78
+ flip flops
79
+ binge drinking
80
+ convict colony
81
+ tell him he's dreaming
82
+ straight to the pool room
83
+ darl
84
+ racist towards kiwis
85
+ skin cancer
86
+ havin' a crack
87
+ red hot go
88
+ underdog
89
+ points for trying
90
+ sunburn
91
+ Men at Work
92
+ Telstra
93
+ waiting on hold for centerlink
94
+ crocs
95
+ ice cold beer
96
+ drop bears
97
+ koala bear
98
+ big fuckoff spider
99
+ hard yakka
100
+ spin bowling
101
+ stumps
102
+ appealing anything
103
+ renovating
104
+ Don Burke's beard
105
+ tin shed
106
+ bundy
107
+ taking the kids to sea world
108
+ Steve Irwin
109
+ battered sav
110
+ liking soccer when we're in the world cup
111
+ fish and chips
112
+ Roy & HG
113
+ little people riding horses
114
+ having a punt
115
+ Sportsbet
116
+ slow internet
117
+ Tony
118
+ you're terrible muriel
119
+ scooped it outta the punnet
120
+ marbo
121
+ Sean Michaleff
122
+ 36 beers in one flight
123
+ Boonie
124
+ smuggling budgies
125
+ stealing land
126
+ getting inappropriately drunk in Bali
127
+ Tony Lockett
128
+ Wayne Carey
129
+ Gary Ablett
130
+ Gary Lions
131
+ Shane Crawford
132
+ Kevin Musket
133
+ Burke & Wills
134
+ blue ringed octopus
135
+ sting ray
136
+ grand final
137
+ box jelly fish
138
+ doll bludger
139
+ cash for babies
140
+ giant fruit monuments
141
+ pavlova
142
+ trifle
143
+ scones
144
+ V8
145
+ cashed up bogans buying fluro work cars
146
+ vomitting your kebab into a taxi
147
+ Skippy
148
+ Paul Hogan
149
+ Crocodile Dundee
150
+ Charlie the Wonder Dog
151
+ Brendan Fevola
152
+ Sizzler
153
+ Harold Halt
154
+ Undeserved gold at the Winter Olympics
155
+ Gough Whitlam
156
+ Today Tonight
157
+ A Current Affair
158
+ the 7 30 Report
159
+ Ray Martin
160
+ Humphrey B Bear
161
+ Great White Shark
162
+ Greg Norman
163
+ Chapelle Corby
164
+ John Horward
165
+ Jeff Kennet
166
+ Qantas
167
+ Anset
168
+ Royal Flying Doctor's Service
169
+ one hand one bounce
170
+ Cricket
171
+ Waltzing Matilda
172
+ Advance Australia Fair
173
+ eating our national animal
data/lib/dingo.rb ADDED
@@ -0,0 +1,54 @@
1
+ require 'enumerator'
2
+
3
+ class Dingo
4
+ DEFAULT_WORD_PATH = File.expand_path("../../dingo.txt", __FILE__)
5
+ SENTENCE_LENGTH = 6
6
+
7
+ class << self
8
+ def words(random: Random.new, source_words: aussie_copy)
9
+ infinite_sequence { aussie_word(source_words, random) }
10
+ end
11
+
12
+ def sentences(random: Random.new, source_words: aussie_copy)
13
+ infinite_sequence { aussie_sentence(source_words, random) }
14
+ end
15
+
16
+ def paragraphs(random: Random.new, source_words: aussie_copy)
17
+ infinite_sequence { aussie_paragraph(source_words, random) }
18
+ end
19
+
20
+ def reset
21
+ @aussie_copy = nil
22
+ @source_words = nil
23
+ end
24
+
25
+ private
26
+
27
+ def infinite_sequence(&block)
28
+ Enumerator.new do |y|
29
+ loop do
30
+ y.yield block.call
31
+ end
32
+ end
33
+ end
34
+
35
+ def aussie_copy
36
+ @aussie_copy ||= File.read(DEFAULT_WORD_PATH).lines.map(&:chomp)
37
+ end
38
+
39
+ def aussie_word(source_words, random)
40
+ @source_words ||= source_words.select { |w| !w.include?(" ") }
41
+ @source_words.sample(random: random)
42
+ end
43
+
44
+ def aussie_sentence(source_words, random)
45
+ sentence = source_words.sample(SENTENCE_LENGTH, random: random).join(" ") + "."
46
+ sentence.capitalize!
47
+ sentence
48
+ end
49
+
50
+ def aussie_paragraph(source_words, random)
51
+ sentences.take(4).join(" ")
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,33 @@
1
+ require 'minitest/autorun'
2
+
3
+ require 'dingo'
4
+
5
+ class DingoTest < MiniTest::Unit::TestCase
6
+ def test_skeleton
7
+ assert_equal 4, Dingo.words.take(4).length
8
+ end
9
+
10
+ def test_makes_a_lot_of_words
11
+ assert_equal 40, Dingo.words.take(40).length
12
+ end
13
+
14
+ def test_makes_only_words
15
+ assert_equal [nil], Dingo.words(source_words: ["more than one word"]).take(1)
16
+ end
17
+
18
+ def test_makes_sentences_with_full_stops
19
+ assert_equal ".", Dingo.sentences.take(1).first[-1]
20
+ end
21
+
22
+ def test_makes_sentences_with_capital_letters
23
+ assert_equal "A", Dingo.sentences(source_words: ["abcdef"]).take(1).first[0]
24
+ end
25
+
26
+ def test_makes_paragraphs
27
+ assert_equal true, !Dingo.paragraphs.take(1)[0].match(/(.*\..*){4}/)[0].empty?
28
+ end
29
+
30
+ def setup
31
+ Dingo.reset
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dingo
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - JaredShay
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Generate true blue copy
14
+ email:
15
+ - jared.shay@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/dingo.rb
21
+ - test/dingo_test.rb
22
+ - README.md
23
+ - dingo.txt
24
+ homepage: https://github.com/jaredshay/dingo
25
+ licenses: []
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.0.14
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Generate true blue copy
47
+ test_files: []