lottery 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8594fcb63b3577af60cc25d8deff1dd183343cc4
4
+ data.tar.gz: 67f08c97dda6ba6449e5a9d4f2cbf9243e848e8b
5
+ SHA512:
6
+ metadata.gz: c7d154e726b63ad0d0d2dbe5f3bfeb0f2a8f280efe02dde38325fa7be5cc9f2eff9aaedc059361c1621a04ae3c428e27055df5ef8fe2870e558f07daedaf9c8a
7
+ data.tar.gz: 4319533bd166139018246678d6361efe93a4b3f8c9d4562803d5c3734f9ecc701b4d868c9c8c36ea2367200b73bde88ad023d60104a265a449ab6db1466f92f5
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## v0.0.1
2
+
3
+ * initial release
4
+ * Support region: SPAIN, Europe and Taiwan.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lottery.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Juanito Fatas
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Lottery
2
+
3
+ Lottery Generator
4
+
5
+ ## Installation
6
+
7
+ Install dependencies:
8
+
9
+ $ bundle install
10
+
11
+ Install Lottery:
12
+
13
+ $ gem install lottery
14
+
15
+ ## Usage
16
+
17
+ ### Europe
18
+
19
+ __Generate Euro Million Numbers:__
20
+
21
+ lottery eu
22
+
23
+ __Generate Lotto Numbers:__
24
+
25
+ lottery eu 1
26
+
27
+ __Generate Thunderball Numbers:__
28
+
29
+ lottery eu 2
30
+
31
+ ### Spain
32
+
33
+ __Generate Daily 6/49:__
34
+
35
+ lottery es
36
+
37
+ __Generate Sunday 5/54+1:__
38
+
39
+ lottery es 1
40
+
41
+ __Generate Spanish 6/49:__
42
+
43
+ lottery es 2
44
+
45
+ ### Taiwan
46
+
47
+ __產生威力彩號碼:__
48
+
49
+ lottery tw
50
+
51
+ __產生大樂透號碼:__
52
+
53
+ lottery tw 1
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
62
+
63
+ ## Author
64
+
65
+ Juanito Fatas
66
+
67
+ ## License
68
+
69
+ MIT License
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/lottery ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + "/../lib/lottery"
4
+ Lottery::Command.start
@@ -0,0 +1,67 @@
1
+ require 'thor'
2
+
3
+ module Lottery
4
+ class Command < Thor
5
+ package_name "Lottery"
6
+
7
+ desc 'eu [type]', 'lotteries in Europe. Including Euro Millions, Lotto, and Thunderball.'
8
+ long_desc <<-EU_LONGDESC
9
+ $ lottery eu
10
+
11
+ generates European lottery numbers. Support Euro Millions, Lotto and Thunderball.
12
+
13
+ $ lottery eu will generate European numbers.
14
+
15
+ $ lottery eu 1 will generate Lotto numbers.
16
+
17
+ $ lottery eu 2 will generate Thunderball numbers.
18
+ ...
19
+ EU_LONGDESC
20
+ def eu(which = 0)
21
+ case which.to_i
22
+ when 1 then puts 'Lotto:'; Lottery::Europe.lotto.pprint
23
+ when 2 then puts 'Thunderball'; Lottery::Europe.thunderball.pprint second_name: 'Thunderball number'
24
+ else puts 'Euro Millions'; Lottery::Europe.euro_millions.pprint second_name: 'Lucky Stars'
25
+ end
26
+ end
27
+
28
+ desc 'tw [類型]', 'Lotteries in Taiwan. Including Lotto649, SuperLotto638, and Daily Cash.'
29
+ long_desc <<-LONGDESC
30
+ $ lottery tw
31
+
32
+ generates Taiwanese Lottery numbers. Support SuperLotto638, Lotto649, and Daily Cash.
33
+
34
+ $ lottery tw will generate SuperLotto638 numbers.
35
+
36
+ $ lottery tw 1 will generate Lotto649 numbers.
37
+
38
+ $ lottery tw 2 will generate Daily Cash numbers.
39
+ LONGDESC
40
+ def tw(which = 0)
41
+ case which.to_i
42
+ when 1 then puts '6/49 Lotto'; Lottery::Taiwan.lotto_649.pprint
43
+ when 2 then puts 'Daily Cash 539:'; Lottery::Taiwan.daily_cash.pprint
44
+ else puts 'Super Lotto 638:'; Lottery::Taiwan.super_lotto_638.pprint first_name: '1st zone', second_name: '2nd zone'
45
+ end
46
+ end
47
+
48
+ desc 'es', 'lotteries in Spain. Including Daily 6/49, Sunday 5/54+1, and Spainsh 6/49.'
49
+ long_desc <<-ES_LONGDESC
50
+ generates Spanish Lottery numbers. Support Daily 6/49, Sunday 5/54+1, and Spainsh 6/49.
51
+
52
+ $ lottery es will generate Daily 6/49 numbers.
53
+
54
+ $ lottery es 1 will generate Sunday 5/54+1 numbers.
55
+
56
+ $ lottery es 2 will generate Spainsh 6/49 numbers.
57
+ ES_LONGDESC
58
+ def es(which = 0)
59
+ case which.to_i
60
+ when 1 then puts 'Sunday 5/54+1'; Lottery::Spain.sunday_5_54_plus1.pprint second_name: 'de matrix'
61
+ when 2 then puts 'Spanish 6/49'; Lottery::Spain.spanish_6_49.pprint
62
+ else puts 'Daily 6/49'; Lottery::Spain.daily_6_49.pprint
63
+ end
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,19 @@
1
+ module Lottery
2
+ module Europe
3
+ include Lottery::LotteryHelper
4
+ extend self
5
+
6
+ def euro_millions
7
+ make_hash(draw(50, 5), draw(11, 2))
8
+ end
9
+
10
+ def lotto
11
+ make_hash(draw(49, 6))
12
+ end
13
+
14
+ def thunderball
15
+ make_hash(draw(39, 5), draw(14, 1))
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ module Lottery
2
+ module LotteryHelper
3
+ def draw(max = 0, amount = 0)
4
+ [*1..max].sample(amount).sort
5
+ end
6
+
7
+ def make_hash(arr1, arr2 = nil)
8
+ { first: arr1, second: arr2 }
9
+ end
10
+ end
11
+
12
+ module LotteryPPrint
13
+
14
+ def pprint(first_name: 'Numbers', second_name: 'Lucky Numbers')
15
+ printf "%s: %s ", first_name, self[:first]
16
+ if self[:second].nil?
17
+ newline
18
+ else
19
+ printf "%s: %s\n", second_name, self[:second]
20
+ end
21
+ end
22
+
23
+ def newline
24
+ puts
25
+ end
26
+
27
+ end
28
+ end
29
+
30
+ class Hash
31
+ include Lottery::LotteryPPrint
32
+ end
@@ -0,0 +1,27 @@
1
+ module Lottery
2
+ module Spain
3
+ include Lottery::LotteryHelper
4
+ extend self
5
+
6
+ # Sunday 5/54+1
7
+ # numbers + de matrix
8
+ # http://www.elgordo.com/shop/tg-play-sunday-554.asp
9
+ def sunday_5_54_plus1
10
+ make_hash(draw(49, 5), draw(11, 1))
11
+ end
12
+
13
+ # Spanish 6/49
14
+ # http://www.elgordo.com/shop/shoplottosen.asp
15
+ def spanish_6_49
16
+ make_hash(draw(49, 6))
17
+ end
18
+
19
+
20
+ # Daily 6/49
21
+ # http://www.elgordo.com/shop/tb-play-daily-649.asp
22
+ def daily_6_49
23
+ make_hash(draw(49, 6))
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ module Lottery
2
+ module Taiwan
3
+ include Lottery::LotteryHelper
4
+ extend self
5
+
6
+ # SuperLotto638
7
+ def super_lotto_638
8
+ make_hash(draw(38, 6), draw(8, 1))
9
+ end
10
+
11
+ # Lotto649
12
+ def lotto_649
13
+ make_hash(draw(49, 6))
14
+ end
15
+
16
+ # Daily Cash
17
+ def daily_cash
18
+ make_hash(draw(39, 5))
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Lottery
2
+ VERSION = "0.0.1"
3
+ end
data/lib/lottery.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "lottery/helper"
2
+ require "lottery/europe"
3
+ require "lottery/taiwan"
4
+ require "lottery/spain"
5
+ require "lottery/command"
6
+ require "lottery/version"
7
+
8
+ module Lottery
9
+
10
+ end
data/lottery.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lottery/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.platform = Gem::Platform::RUBY
8
+
9
+ spec.name = "lottery"
10
+ spec.version = Lottery::VERSION
11
+
12
+ spec.authors = ["Juanito Fatas"]
13
+ spec.email = ["katehuang0320@gmail.com"]
14
+
15
+ spec.description = %q{Lottery Generator in Ruby}
16
+ spec.summary = spec.description
17
+ spec.homepage = "https://github.com/JuanitoFatas/lottery"
18
+
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files`.split($/)
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "thor", "~> 0.18"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.3"
29
+ spec.add_development_dependency "rake"
30
+
31
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lottery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Juanito Fatas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.18'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.18'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Lottery Generator in Ruby
56
+ email:
57
+ - katehuang0320@gmail.com
58
+ executables:
59
+ - lottery
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - CHANGELOG.md
65
+ - Gemfile
66
+ - LICENSE
67
+ - README.md
68
+ - Rakefile
69
+ - bin/lottery
70
+ - lib/lottery.rb
71
+ - lib/lottery/command.rb
72
+ - lib/lottery/europe.rb
73
+ - lib/lottery/helper.rb
74
+ - lib/lottery/spain.rb
75
+ - lib/lottery/taiwan.rb
76
+ - lib/lottery/version.rb
77
+ - lottery.gemspec
78
+ homepage: https://github.com/JuanitoFatas/lottery
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.0.6
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Lottery Generator in Ruby
102
+ test_files: []