twisty 0.1.4 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1991c49ba7c38173acc484a4ff32dee3f51f86572bdac10a8e67b14dd31d9b00
4
- data.tar.gz: 00546c3c4b2a9abee5b6aa3d4fc7057bc20860e9edab03db8345e2a66b015fed
3
+ metadata.gz: 5f1c781f539f60e786f679974578998bf0e1b69eff21b8980804c0ba150f58c3
4
+ data.tar.gz: 69602ce2bcf7579e85da60bc16c312f64da7818eb339f0a92be5febce647371e
5
5
  SHA512:
6
- metadata.gz: 530e2cd6b3dc901a3214d4900e3bbb06ac385866a52d14c6c7d49fe7f312c8a47b24492d90f6f43cfd2c355c48f28ddbf42843b43509c631e031dd76cffcabc6
7
- data.tar.gz: ac6decbe76a6693fa5f90d56d4cb6223a207d516515c1f407dc1cba34240412601cd68ab4eb58ffafe51ccbeb494fdcf693635bdf9db17e4a9da6f3ff88e0b3b
6
+ metadata.gz: 30207c2da3be170aa87713345ca975b8b366dc8aaa07609aed96f39a14a0603e4cad29c3e50f63f623364eb8ba835c4b712721004a5a445c67c91af544cd17f1
7
+ data.tar.gz: 9b47d15f50b238caf7844ceda7bc324574d559820398752ee4e78853506d45837869d6fccacd9091b5507fcef049e740908d37e1879a025e0858365bf9f82ffb
data/lib/twisty/engine.rb CHANGED
@@ -51,7 +51,9 @@ class Engine
51
51
 
52
52
  # TODO: Make private "defining" method
53
53
 
54
- rtype [Symbol, String, String, Hash] => nil
54
+ rtype [Symbol, String, String, Hash] => Item
55
+ #(+Item+)
56
+ #
55
57
  #Creates a new instance of Item in Engine.items indexed by id. Use this
56
58
  #instead of Item.new().
57
59
  #
@@ -79,10 +81,12 @@ class Engine
79
81
  raise GameError.new "Item #{id} has already been defined"
80
82
  end
81
83
 
82
- return nil
84
+ return @items[id]
83
85
  end
84
86
 
85
- rtype [Symbol, String, String] => nil
87
+ rtype [Symbol, String, String] => Room
88
+ #(+Room+)
89
+ #
86
90
  #Creates a new instance of Room in Engine.rooms indexed by id. Use this
87
91
  #instead of Room.new().
88
92
  #
@@ -104,7 +108,7 @@ class Engine
104
108
  @current_room = id
105
109
  end
106
110
 
107
- return nil
111
+ return @rooms[id]
108
112
  end
109
113
 
110
114
  rtype [Symbol, Symbol, String] => nil
data/lib/twisty/item.rb CHANGED
@@ -49,13 +49,15 @@ class Item < Entity
49
49
  @contents = []
50
50
  end
51
51
 
52
- rtype [Symbol] => nil
52
+ rtype [Symbol] => Item
53
+ #(+Item+)
54
+ #
53
55
  #Creates another Item identical to this instance
54
56
  #
55
57
  #other:: (+Symbol+) Index of the new instance of Item
56
58
  def clone(other)
57
- engine.define_item(other, @name, @desc, :fixed => @fixed, :storage => @storage)
58
- return nil
59
+ return engine.define_item(other, @name, @desc,
60
+ :fixed => @fixed, :storage => @storage)
59
61
  end
60
62
  rtype [] => Boolean
61
63
  #(+Boolean+)
@@ -64,7 +66,6 @@ class Item < Entity
64
66
  #on a per-instance basis using on_take(&block). If this returns false
65
67
  #take will fail
66
68
  def take_event
67
- puts "Taken"
68
69
  return true
69
70
  end
70
71
 
@@ -75,7 +76,6 @@ class Item < Entity
75
76
  #on a per-instance basis using on_drop(&block). If this returns false
76
77
  #drop will fail.
77
78
  def drop_event
78
- puts "Dropped"
79
79
  return true
80
80
  end
81
81
 
@@ -88,7 +88,6 @@ class Item < Entity
88
88
  #
89
89
  #item:: (+Symbol+) Key in Engine.items of the item being added
90
90
  def put_content_event(item)
91
- puts "Placed"
92
91
  return true
93
92
  end
94
93
 
data/lib/twisty/room.rb CHANGED
@@ -44,13 +44,14 @@ class Room < Entity
44
44
  @items = []
45
45
  end
46
46
 
47
- rtype [Symbol] => nil
47
+ rtype [Symbol] => Room
48
+ #(+Room+)
49
+ #
48
50
  #Creates another Item identical to this instance
49
51
  #
50
52
  #other:: (+Symbol+) Index of the new instance of Item
51
53
  def clone(other)
52
- engine.define_room(other, @name, @desc)
53
- return nil
54
+ return engine.define_room(other, @name, @desc)
54
55
  end
55
56
 
56
57
  rtype [] => Boolean
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twisty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan McCoskrie