ascii-passport 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/ascii-passport.gemspec +24 -0
- data/lib/ascii-passport.rb +82 -0
- data/lib/ascii-passport/version.rb +3 -0
- metadata +53 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ascii-passport/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ascii-passport"
|
7
|
+
s.version = AsciiPassport::VERSION
|
8
|
+
s.authors = ["Bodaniel Jeanes", "Ri Liu"]
|
9
|
+
s.email = ["me@bjeanes.com", "ri@playfulcreative.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Simple gem built for teaching students how to use gems}
|
12
|
+
s.description = %q{Simple gem built for teaching students how to use gems}
|
13
|
+
|
14
|
+
s.rubyforge_project = "ascii-passport"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "ascii-passport/version"
|
2
|
+
require "date"
|
3
|
+
|
4
|
+
module AsciiPassport
|
5
|
+
DEFAULT_IDENTITY = {
|
6
|
+
"given_name" => "Steve",
|
7
|
+
"surname" => "Jobs",
|
8
|
+
"street" => "100 Infinite Loop",
|
9
|
+
"city" => "Cupertino",
|
10
|
+
"age" => 21, # ish
|
11
|
+
"gender" => "male"
|
12
|
+
}
|
13
|
+
|
14
|
+
def self.build(identity = {})
|
15
|
+
identity = DEFAULT_IDENTITY.merge(identity)
|
16
|
+
|
17
|
+
# Create a random birthday from an age
|
18
|
+
identity["birthday"] = Date.new(
|
19
|
+
Date.today.year - identity["age"].to_i,
|
20
|
+
rand(12) + 1,
|
21
|
+
rand(28) + 1
|
22
|
+
).to_s
|
23
|
+
|
24
|
+
i = lambda { |key| identity[key].ljust(28) } # there are 28 characters of space available on the ID
|
25
|
+
|
26
|
+
if identity["gender"] == "male"
|
27
|
+
<<-PASSPORT
|
28
|
+
,-------------------------------------------------------------.
|
29
|
+
| ,-------------------. |
|
30
|
+
| | _..._ | NAME: #{i["given_name"] }|
|
31
|
+
| | .d$$$$$$$b. | SURNAME: #{i["surname"] }|
|
32
|
+
| | d$$$$$$$$$$$b | |
|
33
|
+
| | d$P^""^$^""^T$b | ADDRESS: #{i["street"] }|
|
34
|
+
| | $$ $$ | #{i["city"] }|
|
35
|
+
| | $;.==. .==.:$ | |
|
36
|
+
| | :; <o>` /<o> :| | BIRTHDAY: #{i["birthday"] }|
|
37
|
+
| | :| |; | |
|
38
|
+
| | : ,_l ; | |
|
39
|
+
| | \\ .___. / | |
|
40
|
+
| | :. - .; | |
|
41
|
+
| | _.; `---' :._ | |
|
42
|
+
| |gd$$$$. .$$$$bp| |
|
43
|
+
| '^^^^^^^^=-=^^^^^^^^' |
|
44
|
+
| |
|
45
|
+
| |
|
46
|
+
|-----------------------------------+--------------+----------|
|
47
|
+
| >>>>>125KTKRST098RT>>>3>>>RS235>23| NO: #{id } | 18/03/03 |
|
48
|
+
'-----------------------------------^--------------^----------'
|
49
|
+
PASSPORT
|
50
|
+
else
|
51
|
+
<<-PASSPORT
|
52
|
+
,-------------------------------------------------------------.
|
53
|
+
| ,-------------------. |
|
54
|
+
| | _=mMMM;, | NAME: #{i["given_name"] }|
|
55
|
+
| | mt;MMHMMHm, | SURNAME: #{i["surname"] }|
|
56
|
+
| | S;`"';'`';MMm | |
|
57
|
+
| | iM|- --|Mml | ADDRESS: #{i["street"] }|
|
58
|
+
| | Im|*' l `*'$|mll | #{i["city"] }|
|
59
|
+
| | IMs L /Smll | |
|
60
|
+
| | IMS ____ lSmllL | BIRTHDAY: #{i["birthday"] }|
|
61
|
+
| | IMm\\ `--' /SMmlMl | |
|
62
|
+
| | ImMm\\____/SMMmlML | |
|
63
|
+
| | IMMMMm) |mMmmlLl| |
|
64
|
+
| | IMmKm; ;MmMmmm| |
|
65
|
+
| |[ '"'"'"' ]| |
|
66
|
+
| |___________________| |
|
67
|
+
| |
|
68
|
+
| |
|
69
|
+
| |
|
70
|
+
|-----------------------------------+--------------+----------|
|
71
|
+
| >>>>>125KTKRST098RT>>>3>>>RS235>23| NO: #{id } | 18/03/03 |
|
72
|
+
'-----------------------------------^--------------^----------'
|
73
|
+
PASSPORT
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
def self.id
|
79
|
+
"PL#{"%06d" % rand(9999)}"
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ascii-passport
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bodaniel Jeanes
|
9
|
+
- Ri Liu
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-10-11 00:00:00.000000000Z
|
14
|
+
dependencies: []
|
15
|
+
description: Simple gem built for teaching students how to use gems
|
16
|
+
email:
|
17
|
+
- me@bjeanes.com
|
18
|
+
- ri@playfulcreative.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- Gemfile
|
25
|
+
- Rakefile
|
26
|
+
- ascii-passport.gemspec
|
27
|
+
- lib/ascii-passport.rb
|
28
|
+
- lib/ascii-passport/version.rb
|
29
|
+
homepage: ''
|
30
|
+
licenses: []
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project: ascii-passport
|
49
|
+
rubygems_version: 1.8.6
|
50
|
+
signing_key:
|
51
|
+
specification_version: 3
|
52
|
+
summary: Simple gem built for teaching students how to use gems
|
53
|
+
test_files: []
|