scoped_struct 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +8 -3
- data/VERSION +1 -1
- metadata +1 -1
data/README
CHANGED
@@ -37,7 +37,7 @@ And then instead of those long ugly method names, you could just be all like,
|
|
37
37
|
|
38
38
|
Eez better, yes?
|
39
39
|
|
40
|
-
The methods you define in the scoping block, when called, run in the same context as if you defined them on the class itself. So you
|
40
|
+
The methods you define in the scoping block, when called, run in the same context as if you defined them on the class itself. So you can have them referencing instance variables or other methods of the class as if they were local. Likewise, you can also reference other scoped methods from scoped methods, even from other scopes; just make sure to reference them by their full scoped path:
|
41
41
|
|
42
42
|
class Player
|
43
43
|
def name
|
@@ -63,7 +63,7 @@ The methods you define in the scoping block, when called, run in the same contex
|
|
63
63
|
|
64
64
|
Player.new.actions.scream_twice # prints "MY NAME IS JOHN RAMBO!!!" twice
|
65
65
|
|
66
|
-
And that's not all!
|
66
|
+
And that's not all! You can take the object returned by the scoping method and pass it around like any other object. It will still act the way you'd expect:
|
67
67
|
|
68
68
|
fumble_records = my_players.collect{|player| player.fumbles}
|
69
69
|
fumble_records.first.dropped
|
@@ -88,6 +88,9 @@ And if you want even more organizational fun, you can stick your methods in modu
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
== Installation
|
92
|
+
|
93
|
+
gem install scoped_struct
|
91
94
|
|
92
95
|
== Troubleshooting
|
93
96
|
|
@@ -97,4 +100,6 @@ One thing that will cause weirdness is if you name a scoped method the same thin
|
|
97
100
|
|
98
101
|
By Mike Ferrier (http://www.mikeferrier.ca)
|
99
102
|
|
100
|
-
Contributions by Hampton Catlin (http://www.hamptoncatlin.com)
|
103
|
+
Contributions by Hampton Catlin (http://www.hamptoncatlin.com)
|
104
|
+
|
105
|
+
Idea conceived and percolated at the Unspace offices (http://unspace.ca)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2
|