inspire 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/inspire +10 -0
  3. data/lib/inspire.rb +131 -0
  4. metadata +70 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7f68b54b267dc19df625c4fff03ca31bd3b6c6ce
4
+ data.tar.gz: c3326ed18f07d8e9965a8f8e83930bca42374392
5
+ SHA512:
6
+ metadata.gz: 18ed86c035d71001fadd416706384b27337074aeb2ab60b60ad275275d017a6b2bcbc7f976222caa58284547a69bfbae5791a4b8d0dc40d92a9790f6e6beefc3
7
+ data.tar.gz: 5f2179a6250c0afdae8431d0a5f9b7d4360bea7c453890dde4b2992e07bd270d71eaef046a53ad5ce7340a021097e8dea8bfd1d6613408e7c86d1bb4b758fcae
data/bin/inspire ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'inspire'
4
+
5
+ if ARGV[0] == 'me'
6
+ inspire = Inspire.new
7
+ inspire.quiz
8
+ else
9
+ puts "inspire \e[4mwho\e[0m?"
10
+ end
data/lib/inspire.rb ADDED
@@ -0,0 +1,131 @@
1
+ require 'base64'
2
+
3
+ class Inspire
4
+ def quiz
5
+ quiz = Quiz.new
6
+ quiz.start
7
+ end
8
+ end
9
+
10
+ class Quiz
11
+ def initialize
12
+ @answers = {}
13
+ @questions = [
14
+ { id: 1,
15
+ question: 'Inspire is currently innovating with which wearable?',
16
+ answers: {
17
+ a: 'Fitbit',
18
+ b: 'Oculus Rift',
19
+ c: 'Empatica'
20
+ }
21
+ },
22
+ { id: 2,
23
+ question: 'Which monument marks the view from the Inspire office?',
24
+ answers: {
25
+ a: 'The Dom in Utrecht',
26
+ b: 'The Rijksmuseum in Amsterdam',
27
+ c: 'Kissing Earth in Rotterdam'
28
+ }
29
+ },
30
+ { id: 3,
31
+ question: 'Which of these clients best fits Inspire?',
32
+ answers: {
33
+ a: 'A large marketing concern',
34
+ b: 'An educational publisher',
35
+ c: 'The tax authority'
36
+ }
37
+ },
38
+ { id: 4,
39
+ question: 'Which Ruby conference did the Inspire team visit in 2015?',
40
+ answers: {
41
+ a: 'Baruco',
42
+ b: 'ArrrrCamp',
43
+ c: 'Euruko'
44
+ }
45
+ }
46
+ ]
47
+ end
48
+
49
+ def start
50
+ @questions.each do |q|
51
+ question = Question.new(q)
52
+ question.show
53
+ question.ask
54
+ @answers[q[:id]] = question.resolve
55
+ end
56
+ finish
57
+ end
58
+
59
+ def mail_hash
60
+ Base64.urlsafe_encode64(@answers.flatten.join)
61
+ end
62
+
63
+ def correct?
64
+ Base64.urlsafe_encode64(mail_hash) == 'TVdNeVlUTmlOR0k9'
65
+ end
66
+
67
+ def correct_feedback
68
+ 'all correct!'
69
+ end
70
+
71
+ def incorrect_feedback
72
+ "not
73
+ completely correct, but we won't hold it against you."
74
+ end
75
+
76
+ def finish
77
+ puts "
78
+
79
+ #---------------------------------------------------------------------------#
80
+ Cool! Thanks for answering these questions. Your answers were #{correct? ? correct_feedback : incorrect_feedback}
81
+
82
+ Now you know that Inspire is an innovative software development company
83
+ in Utrecht. We make high quality digital products that have a meaningful
84
+ impact on people's well-being. Our work touches people.
85
+
86
+ Does this sound attractive to you? We are hiring new talent! Mail your
87
+ motivation and CV to: jobs+#{mail_hash}@inspire.nl
88
+
89
+ #---------------------------------------------------------------------------#
90
+
91
+ "
92
+ end
93
+ end
94
+
95
+ class Question
96
+ def initialize (question)
97
+ @question = question
98
+ end
99
+
100
+ def show
101
+ puts "
102
+ #---------------------------------------------------------------------------#
103
+ #{@question[:question]}
104
+ #---------------------------------------------------------------------------#
105
+ "
106
+ @question[:answers].each do |key, answer|
107
+ puts " #{ key }: #{ answer }
108
+ "
109
+ end
110
+ puts "
111
+ #---------------------------------------------------------------------------#
112
+ "
113
+ end
114
+
115
+ def ask
116
+ @answer = STDIN.gets.chomp.to_sym
117
+ until valid do
118
+ puts 'please answer a, b or c'
119
+ @answer = STDIN.gets.chomp.to_sym
120
+ end
121
+ end
122
+
123
+ def valid
124
+ @question[:answers].keys.include? @answer
125
+ end
126
+
127
+ def resolve
128
+ puts "you answered: #{ @answer }: #{ @question[:answers][@answer] }"
129
+ @answer
130
+ end
131
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inspire
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Rik van Duijn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The gem that follows on the postcard. Will you continue on this road?
14
+ email: rik@inspire.nl
15
+ executables:
16
+ - inspire
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/inspire
21
+ - lib/inspire.rb
22
+ homepage: http://www.inspire.nl
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message: "\n ,, .:.\n
27
+ :::: ;::::\n:::::, :::::\n:::::,
28
+ \ :::::\n :::: :::::\n
29
+ \ :: .:.\n\n\n`::::` ::::` :::::,
30
+ \ ,,,,,,. ,,,,` ,::::, ;:::: ::::: ;;;;;;;;;;;;\n`::::` :::: :::::::: `,,,,,,,,,
31
+ ,,,,`,,:::::; ::::: :::::`::;;;;;;;;;;;;:\n`::::` ::::::::::::: ,,,,,,,,, ,,,,,,,::::::;
32
+ \ ::::: ;:::::::;;;;;;;;;;;;;\n`::::` ::::::,,:::::, `,,,, `, ,,,,,,,:::::::`
33
+ ::::: ;;::::::;;;;;; .;;;\n`::::` ::::: ::::: .,,,,` ,,,,,` :::::: :::::
34
+ ;;;:::. ,;;;; ;;;;\n`::::` ::::. ::::: `,,,,,,,, ,,,,, ::::: :::::
35
+ ;;;;:` ;;;;;;;;;;;;;;\n`::::` ::::` ::::: :,,,,,,,, ,,,: ::::: :::::
36
+ ;;;;; ;;;;;;;;;;;;;;\n`::::` ::::` ::::: ,,,,,,,,, ,,,: ::::: :::::
37
+ ;;;;; ;;;;;;;;;;;'''\n`::::` ::::` :,::: .,,,,, ,,,:, ::::: :::::
38
+ ;;;;; ;;;;;\n`::::` ::::` :,,:: `` .,,,, ,,,::, :::::: ::::: ;;;;; ,;;;;
39
+ \ ,,,,\n`::::` ::::` :,,,: `,,,..,,,,, ,,,::::;,:::::` ::::: ;;;;; ;;;;;.
40
+ `;;;;\n`::::` ::::` :,,,,`,,,,,,,,,,. ,,,::::::::::; ::::: ;;;;; .;;;;;;;;;;;\n`::::`
41
+ ::::` :,,,, :,,,,,,,,, ,,,:.:::::::; ::::: ;;;;; .;;;;;;;;;;\n`:::: ::,,`
42
+ \ ,,,,, ,,,,,, ,,,:` :;;::` ::::: ::::: ,;;;;;;\n ,,,:`\n
43
+ \ ,,,:`\n ,,,:`\n
44
+ \ ,,,:`\n ,,,:`\n
45
+ \ ,,,:`\n\n #---------------------------------------------------------------------------#\n
46
+ \ Great! You found the inspire gem, either because you found our postcard\n and
47
+ have a curious mind, because someone directed you here, or because you\n just
48
+ happened to stumble upon it. Whichever it is, won't you take some\n time to continue
49
+ and see what we have to offer? Run 'inspire me'.\n #---------------------------------------------------------------------------#\n\n\n
50
+ \ "
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.2.2
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Inspire postcard gem
70
+ test_files: []