room 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/examples/example1.rb CHANGED
@@ -8,6 +8,7 @@ class Intro < Room
8
8
  "This is Room," |
9
9
  "a virtual world for you to explore." |
10
10
  "At any time, you can type 'help', but it won't do anything." |
11
+ "I recommend falling back to 'look' instead." |
11
12
  "" |
12
13
  "Start by entering the room."
13
14
  end
@@ -33,6 +34,10 @@ class Bedroom < Room
33
34
  "Everything else is a blur."
34
35
  end
35
36
 
37
+ def pencil
38
+ "That's not even close to a sentence. Where's the verb??"
39
+ end
40
+
36
41
  def look_closet
37
42
  @looked_left = true
38
43
  "It looks like a normal closet." |
@@ -109,6 +114,7 @@ class Bedroom < Room
109
114
  huh?
110
115
  end
111
116
  end
117
+ dup :look_right
112
118
 
113
119
  def jump_into_chute
114
120
  if @sharpened_pencil
@@ -135,13 +141,15 @@ class Closet < Room
135
141
  (if @got_pencil
136
142
  "No wait, you can still exit the closet."
137
143
  else
138
- "You stub your toe on something sharp. It feels like a pencil."
144
+ "You stub your toe on something sharp. It feels like a pencil." |
145
+ "You suddenly want to get the pencil."
139
146
  end)
140
147
  end
141
148
 
142
149
  def stub_toe
143
150
  "You already did that!"
144
151
  end
152
+ dup :stub
145
153
 
146
154
  def open_door
147
155
  "The door won't budge."
@@ -164,7 +172,8 @@ class Closet < Room
164
172
  else
165
173
  take :pencil
166
174
  @got_pencil = true
167
- "Awesome, a pencil! You place the pencil in your pocket."
175
+ "Awesome, a pencil! You place the pencil in your pocket." |
176
+ "Something has changed around you."
168
177
  end
169
178
  end
170
179
  dup :get_the_pencil
@@ -190,7 +199,17 @@ class Skiing1 < Room
190
199
  "That was delicious." |
191
200
  go("skiing2")
192
201
  end
193
- dup :eat_the_snow
202
+ dup :eat_the_snow, :swallow
203
+
204
+ def spit_snow
205
+ "You spit out that nasty snow!" |
206
+ go("skiing2")
207
+ end
208
+ dup :spit
209
+
210
+ def ski
211
+ go("skiing2")
212
+ end
194
213
  end
195
214
 
196
215
  class Skiing2 < Room
data/lib/room.rb CHANGED
@@ -34,7 +34,7 @@ class Printer
34
34
  end
35
35
 
36
36
  class Room
37
- DEFAULT_COMMANDS = [["look".commandify, :look], ["l".commandify, :look]]
37
+ DEFAULT_COMMANDS = [["look".commandify, :look], ["l".commandify, :look], ["look_around".commandify, :look]]
38
38
 
39
39
  def go key
40
40
  Room.go key
data/room.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{room}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tom Lieber"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: room
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Lieber