simple-decorator 0.1.0 → 0.1.1
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/lib/simple_decorator.rb +7 -6
- metadata +1 -1
data/lib/simple_decorator.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
#
|
1
|
+
# Author:: Gabriel Dehan (gabriel-dehan)
|
2
|
+
# License:: WTFPL (http://sam.zoy.org/wtfpl/COPYING)
|
2
3
|
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# License: WTFPL (http://sam.zoy.org/wtfpl/COPYING)
|
4
|
+
# Allows you to give true decorator behavior to your classes.
|
6
5
|
class SimpleDecorator < BasicObject
|
7
|
-
undef_method :==
|
6
|
+
#undef_method :==
|
8
7
|
|
8
|
+
# Stores the decorated object
|
9
9
|
def initialize(component)
|
10
10
|
@component = component
|
11
11
|
end
|
12
12
|
|
13
|
+
# Returns the component
|
13
14
|
def decorated
|
14
15
|
@component
|
15
16
|
end
|
16
17
|
alias :source :decorated
|
17
18
|
|
18
|
-
def method_missing(n, *a, &b); @component.send(n, *a, &b) end
|
19
19
|
def send(s, *a); __send__(s, *a) end
|
20
|
+
def method_missing(n, *a, &b); @component.send(n, *a, &b) end
|
20
21
|
end
|