alexckrandomizer 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +19 -0
- data/README.md +35 -0
- data/Rakefile +4 -0
- data/alexckrandomizer-0.1.0.gem +0 -0
- data/alexckrandomizer.gemspec +36 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/alexckrandomizer/version.rb +5 -0
- data/lib/alexckrandomizer.rb +61 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a475dea925e54b56a9ceb99e7e7383b64be1e9371b9a0f93acb959f4de6f8422
|
4
|
+
data.tar.gz: 53450042c027cad891a363903307bf4798280ff881a33fbeacba8f3b28c103df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cddbf5915106143d384b2648a075182c93859d60cfef2f023fa427c9ba88ff21f81ca06840e04f86c333eb83259ee786cfa8285f6fe307b80fc9e587e97dbbec
|
7
|
+
data.tar.gz: dcf88b5d0c1861ee3599172d96d5a4f051e4ee04e2b27222796ed9400110c918e3834482c0582c1934b2ba54a821f28c289b6ed0a588e17201614fcac68669be
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Alexckrandomizer
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/alexckrandomizer`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'alexckrandomizer'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install alexckrandomizer
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/alexckrandomizer.
|
data/Rakefile
ADDED
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/alexckrandomizer/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "alexckrandomizer"
|
7
|
+
spec.version = Alexckrandomizer::VERSION
|
8
|
+
spec.authors = ["Alex Krueger"]
|
9
|
+
spec.email = ["alexckrueger@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Randomizes stuff"
|
12
|
+
spec.homepage = "https://github.com/alexckrueger/alexckrandomizer"
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
|
+
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/alexckrueger/alexckrandomizer"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/alexckrueger/alexckrandomizer"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
# Uncomment to register a new dependency of your gem
|
32
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
33
|
+
|
34
|
+
# For more information and examples about making a new gem, checkout our
|
35
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "alexckrandomizer"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "alexckrandomizer/version"
|
4
|
+
|
5
|
+
module Alexckrandomizer
|
6
|
+
class Error < StandardError; end
|
7
|
+
|
8
|
+
class Coin
|
9
|
+
def flip
|
10
|
+
number = rand(1..2)
|
11
|
+
if number == 1
|
12
|
+
return "heads"
|
13
|
+
else
|
14
|
+
return "tails"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def cards
|
20
|
+
number = rand(1..13)
|
21
|
+
if number == 1
|
22
|
+
number = "Ace"
|
23
|
+
elsif number == 11
|
24
|
+
number = "Jack"
|
25
|
+
elsif number == 12
|
26
|
+
number = "Queen"
|
27
|
+
elsif number == 13
|
28
|
+
number = "King"
|
29
|
+
end
|
30
|
+
|
31
|
+
suit = rand(1..4)
|
32
|
+
if suit == 1
|
33
|
+
suit = "clubs"
|
34
|
+
elsif suit == 2
|
35
|
+
suit = "spades"
|
36
|
+
elsif suit == 3
|
37
|
+
suit = "diamonds"
|
38
|
+
else
|
39
|
+
suit = "hearts"
|
40
|
+
end
|
41
|
+
|
42
|
+
return "#{number} of #{suit}."
|
43
|
+
end
|
44
|
+
|
45
|
+
def dice(die)
|
46
|
+
rolls = []
|
47
|
+
die.times do
|
48
|
+
rolls << rand(1..6)
|
49
|
+
end
|
50
|
+
return rolls
|
51
|
+
end
|
52
|
+
|
53
|
+
def lottery(picks, highest_number)
|
54
|
+
draw = []
|
55
|
+
picks.times do
|
56
|
+
draw << rand(1..highest_number)
|
57
|
+
end
|
58
|
+
return draw
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alexckrandomizer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Krueger
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- alexckrueger@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- Gemfile.lock
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- alexckrandomizer-0.1.0.gem
|
25
|
+
- alexckrandomizer.gemspec
|
26
|
+
- bin/console
|
27
|
+
- bin/setup
|
28
|
+
- lib/alexckrandomizer.rb
|
29
|
+
- lib/alexckrandomizer/version.rb
|
30
|
+
homepage: https://github.com/alexckrueger/alexckrandomizer
|
31
|
+
licenses: []
|
32
|
+
metadata:
|
33
|
+
homepage_uri: https://github.com/alexckrueger/alexckrandomizer
|
34
|
+
source_code_uri: https://github.com/alexckrueger/alexckrandomizer
|
35
|
+
changelog_uri: https://github.com/alexckrueger/alexckrandomizer
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.6.0
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubygems_version: 3.2.32
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: Randomizes stuff
|
55
|
+
test_files: []
|