context 0.0.16 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/COPYING +679 -0
- data/README +188 -0
- data/Rakefile.rb +64 -18
- data/lib/Context/Bridge.rb +7 -6
- data/lib/Context/Context.rb +14 -35
- data/lib/Context/Gtk/Widget.rb +139 -33
- data/lib/Context/Log.rb +10 -0
- data/lib/Context/Publisher.rb +108 -0
- data/lib/Context/Spec.rb +8 -0
- data/lib/Context/Version.rb +1 -1
- data/lib/Context/View.rb +16 -15
- data/lib/Context/Views/Gtk/PageView.rb +3 -23
- data/lib/Context/Views/Gtk/Widgets/MainWindow.rb +70 -0
- data/lib/Context/Views/Gtk/Widgets/VBox.rb +29 -0
- data/lib/Context/Widget.rb +18 -27
- data/spec/Context/Bridge_spec.rb +19 -20
- data/spec/Context/Context_spec.rb +77 -63
- data/spec/Context/Gtk/Widget_spec.rb +23 -23
- data/spec/Context/Publisher_spec.rb +53 -0
- data/spec/Context/View_spec.rb +10 -14
- data/spec/Context/Views/Gtk/PageView_spec.rb +25 -9
- data/spec/Context/require_all_spec.rb +14 -7
- data/test_results.html +84 -121
- metadata +74 -128
- data/coverage/-usr-local-lib-site_ruby-1_8-atk_rb.html +0 -612
- data/coverage/-usr-local-lib-site_ruby-1_8-gdk_pixbuf2_rb.html +0 -637
- data/coverage/-usr-local-lib-site_ruby-1_8-glib2_rb.html +0 -829
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2-base_rb.html +0 -709
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2_rb.html +0 -623
- data/coverage/-usr-local-lib-site_ruby-1_8-pango_rb.html +0 -665
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-color_rb.html +0 -865
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-colors_rb.html +0 -1266
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-constants_rb.html +0 -632
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-blur_rb.html +0 -655
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-circle_rb.html +0 -619
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-color_rb.html +0 -621
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-path_rb.html +0 -726
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-rectangle_rb.html +0 -643
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-triangle_rb.html +0 -622
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context_rb.html +0 -639
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-paper_rb.html +0 -793
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-papers_rb.html +0 -651
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-path_rb.html +0 -625
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-point_rb.html +0 -617
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo_rb.html +0 -756
- data/coverage/index.html +0 -1170
- data/coverage/lib-Context-Bridge_rb.html +0 -673
- data/coverage/lib-Context-Context_rb.html +0 -756
- data/coverage/lib-Context-EnumeratedType_rb.html +0 -661
- data/coverage/lib-Context-ExecutionProxy_rb.html +0 -671
- data/coverage/lib-Context-Gtk-App_rb.html +0 -638
- data/coverage/lib-Context-Gtk-Key_rb.html +0 -664
- data/coverage/lib-Context-Gtk-Widget_rb.html +0 -667
- data/coverage/lib-Context-KeyAssignment_rb.html +0 -641
- data/coverage/lib-Context-KeyMap_rb.html +0 -653
- data/coverage/lib-Context-Key_rb.html +0 -667
- data/coverage/lib-Context-View_rb.html +0 -659
- data/coverage/lib-Context-Views-Gtk-PageView_rb.html +0 -660
- data/coverage/lib-Context-Views-PageView_rb.html +0 -627
- data/coverage/lib-Context-Widget_rb.html +0 -650
- data/coverage/lib-Context-require_all_rb.html +0 -623
- data/doc/classes/Context.html +0 -174
- data/doc/classes/Context/Bridge.html +0 -296
- data/doc/classes/Context/Context.html +0 -564
- data/doc/classes/Context/EnumeratedType.html +0 -283
- data/doc/classes/Context/ExecutionProxy.html +0 -228
- data/doc/classes/Context/Gtk.html +0 -126
- data/doc/classes/Context/Gtk/App.html +0 -217
- data/doc/classes/Context/Gtk/Key.html +0 -292
- data/doc/classes/Context/Gtk/PageView.html +0 -245
- data/doc/classes/Context/Gtk/PageView/MainWindow.html +0 -200
- data/doc/classes/Context/Gtk/Widget.html +0 -311
- data/doc/classes/Context/Key.html +0 -305
- data/doc/classes/Context/Key/Modifier.html +0 -117
- data/doc/classes/Context/KeyAssignment.html +0 -234
- data/doc/classes/Context/KeyMap.html +0 -273
- data/doc/classes/Context/PageView.html +0 -180
- data/doc/classes/Context/View.html +0 -334
- data/doc/classes/Context/Widget.html +0 -298
- data/doc/classes/Kernel.html +0 -148
- data/doc/classes/Object.html +0 -196
- data/doc/created.rid +0 -1
- data/doc/files/lib/Context/Bridge_rb.html +0 -108
- data/doc/files/lib/Context/Context_rb.html +0 -109
- data/doc/files/lib/Context/EnumeratedType_rb.html +0 -101
- data/doc/files/lib/Context/ExecutionProxy_rb.html +0 -101
- data/doc/files/lib/Context/Gtk/App_rb.html +0 -110
- data/doc/files/lib/Context/Gtk/Key_rb.html +0 -109
- data/doc/files/lib/Context/Gtk/Widget_rb.html +0 -109
- data/doc/files/lib/Context/KeyAssignment_rb.html +0 -108
- data/doc/files/lib/Context/KeyMap_rb.html +0 -109
- data/doc/files/lib/Context/Key_rb.html +0 -108
- data/doc/files/lib/Context/Version_rb.html +0 -101
- data/doc/files/lib/Context/View_rb.html +0 -101
- data/doc/files/lib/Context/Views/Gtk/PageView_rb.html +0 -111
- data/doc/files/lib/Context/Views/PageView_rb.html +0 -108
- data/doc/files/lib/Context/Widget_rb.html +0 -101
- data/doc/files/lib/Context/require_all_rb.html +0 -101
- data/doc/fr_class_index.html +0 -46
- data/doc/fr_file_index.html +0 -42
- data/doc/fr_method_index.html +0 -103
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/lib/Context/EnumeratedType.rb +0 -51
- data/lib/Context/ExecutionProxy.rb +0 -61
- data/lib/Context/Gtk/Key.rb +0 -54
- data/lib/Context/Key.rb +0 -57
- data/lib/Context/KeyAssignment.rb +0 -31
- data/lib/Context/KeyMap.rb +0 -43
- data/spec/Context/EnumeratedType_spec.rb +0 -51
- data/spec/Context/ExecutionProxy_spec.rb +0 -28
- data/spec/Context/Gtk/Key_spec.rb +0 -45
- data/spec/Context/KeyAssignment_spec.rb +0 -26
- data/spec/Context/KeyMap_spec.rb +0 -64
- data/spec/Context/Key_spec.rb +0 -22
- data/spec/Context/Widget_spec.rb +0 -15
data/lib/Context/Log.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
module Context
|
2
|
+
|
3
|
+
# Publisher implements an observer pattern.
|
4
|
+
# An object creates a Publisher, using itself as the source.
|
5
|
+
# It can then publish to several different streams. Observers can
|
6
|
+
# subscribe to a stream. When the stream for an observer
|
7
|
+
# is updated, a method on each observer, named <stream>Updated(),
|
8
|
+
# is called. The source is passed to this method.
|
9
|
+
# In Context, Publishers are usually used to notify Contexts
|
10
|
+
# when model objects have been updated (and hence the view
|
11
|
+
# needs to change).
|
12
|
+
class Publisher
|
13
|
+
attr_reader :source
|
14
|
+
|
15
|
+
# Create a Publisher with the source as the source object.
|
16
|
+
def initialize(source)
|
17
|
+
@source = source
|
18
|
+
@streamSubscribers = {}
|
19
|
+
@blocked = false
|
20
|
+
end
|
21
|
+
|
22
|
+
# Subscribe an observer to a stream. The stream must be
|
23
|
+
# a string. It is allowable to observe to streams that
|
24
|
+
# don't exist. The observer *must* implement
|
25
|
+
# <stream>Updated(source). For example if in a method
|
26
|
+
# of class A I write:
|
27
|
+
# publisher.subscribe(self, "hello")
|
28
|
+
# then A *must* implement the method helloUpdated(source)
|
29
|
+
# otherwise the program will crash when the stream
|
30
|
+
# is publish.
|
31
|
+
def subscribe(observer, stream)
|
32
|
+
if @streamSubscribers.has_key?(stream)
|
33
|
+
observers = @streamSubscribers[stream]
|
34
|
+
if !observers.find do |x|
|
35
|
+
x == observer
|
36
|
+
end
|
37
|
+
observers.push(observer)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
@streamSubscribers[stream] = [observer]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Unsubscribe an observer from the stream.
|
45
|
+
# Remove the observer from the list of objects
|
46
|
+
# that are subscribed to the stream.
|
47
|
+
# Very Important Note: If you don't unsubscribe
|
48
|
+
# from a publisher at the end of the lifetime
|
49
|
+
# of your object, the publisher will retain
|
50
|
+
# a reference to the object. This means it will
|
51
|
+
# continue to exist until the publisher is destroyed.
|
52
|
+
# This could potentially cause problems in your code.
|
53
|
+
# *Always* unsubscribe from a Publisher when you are
|
54
|
+
# finished with the object.
|
55
|
+
def unsubscribe(observer, stream)
|
56
|
+
if @streamSubscribers.has_key?(stream)
|
57
|
+
observers = @streamSubscribers[stream]
|
58
|
+
observers.delete(observer)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Publish to the observers that the stream has been updated.
|
63
|
+
# This is usually called by the source object, but it
|
64
|
+
# doesn't have to be. The source object can also be changed
|
65
|
+
# (it defaults to the source in the Publisher). This is
|
66
|
+
# useful if a source is publishing on behalf of another object
|
67
|
+
# (essentially acting as a mediator).
|
68
|
+
def update(stream, source=@source)
|
69
|
+
if blocked?
|
70
|
+
return
|
71
|
+
end
|
72
|
+
if @streamSubscribers.has_key?(stream)
|
73
|
+
@streamSubscribers[stream].each do |subscriber|
|
74
|
+
eval("subscriber." + stream + "Updated(source)")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Returns true if the publisher is blocked.
|
80
|
+
# A blocked publisher will not publish, even if
|
81
|
+
# update() is called.
|
82
|
+
def blocked?
|
83
|
+
@blocked
|
84
|
+
end
|
85
|
+
|
86
|
+
# Block a publisher from publishing. A blocked publisher
|
87
|
+
# will not publish to observers, even if update() is
|
88
|
+
# called. This is useful for when you know that the
|
89
|
+
# source is being updated a lot and you only want to
|
90
|
+
# signal it at the end (for instance when you are loading
|
91
|
+
# a file).
|
92
|
+
# Important Note: block() and unblock() are not counted.
|
93
|
+
# No matter how many times you call block(), the first
|
94
|
+
# unblock() will unblock it.
|
95
|
+
def block
|
96
|
+
@blocked = true
|
97
|
+
end
|
98
|
+
|
99
|
+
# Unblock a publisher so that it may continue to publish.
|
100
|
+
# Important Note: block() and unblock() are not counted.
|
101
|
+
# No matter how many times you call block(), the first
|
102
|
+
# unblock() will unblock it.
|
103
|
+
def unblock
|
104
|
+
@blocked = false
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
data/lib/Context/Spec.rb
ADDED
data/lib/Context/Version.rb
CHANGED
data/lib/Context/View.rb
CHANGED
@@ -12,38 +12,39 @@ module Context
|
|
12
12
|
if(myWidget != nil)
|
13
13
|
newWidget = view.getWidget()
|
14
14
|
if !newWidget.nil?
|
15
|
-
myWidget.
|
16
|
-
newWidget.
|
15
|
+
myWidget.addToThisWidget(newWidget)
|
16
|
+
newWidget.widgetWasAddedTo(myWidget)
|
17
17
|
end
|
18
18
|
end
|
19
|
+
view.viewAddedTo(self)
|
19
20
|
end
|
21
|
+
|
22
|
+
# Override this method to do something when your view has been
|
23
|
+
# added to another view. Most useful for adding subviews
|
24
|
+
def viewAddedTo(parent)
|
25
|
+
end
|
20
26
|
|
21
27
|
def removeView(view)
|
28
|
+
view.removingViewFrom(self)
|
22
29
|
myWidget = getWidget()
|
23
30
|
if(myWidget != nil)
|
24
31
|
oldWidget = view.getWidget()
|
25
32
|
if !oldWidget.nil?
|
26
|
-
myWidget.
|
27
|
-
oldWidget.
|
33
|
+
myWidget.removeFromThisWidget(oldWidget)
|
34
|
+
oldWidget.widgetWasRemovedFrom(myWidget)
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
31
|
-
|
32
|
-
# Concrete classes should override this method
|
33
|
-
def open
|
34
|
-
end
|
35
|
-
|
36
|
-
# Concrete classes should override this method
|
37
|
-
def close
|
38
|
-
end
|
39
38
|
|
39
|
+
# Override this method to do something when your view being
|
40
|
+
# removed from another view. Most useful for removing subviews
|
41
|
+
def removingViewFrom(parent)
|
42
|
+
end
|
43
|
+
|
40
44
|
# Concrete classes should override this method
|
41
45
|
def getWidget
|
42
46
|
return nil
|
43
47
|
end
|
44
48
|
|
45
|
-
def notifyKey(widget, key)
|
46
|
-
@context.notifyKey(self, key)
|
47
|
-
end
|
48
49
|
end
|
49
50
|
end
|
@@ -1,46 +1,26 @@
|
|
1
1
|
require 'Context/Views/PageView'
|
2
|
-
require 'Context/Gtk/Key'
|
3
2
|
require 'Context/Gtk/Widget'
|
3
|
+
require 'Context/Views/Gtk/Widgets/MainWindow'
|
4
4
|
require 'gtk2'
|
5
5
|
|
6
6
|
module Context::Gtk
|
7
7
|
|
8
8
|
class PageView < Context::PageView
|
9
9
|
|
10
|
-
class MainWindow < Gtk::Window
|
11
|
-
def initialize(title, view)
|
12
|
-
super(title)
|
13
|
-
@view = view
|
14
|
-
connectSignals unless @view.nil?
|
15
|
-
end
|
16
|
-
|
17
|
-
def connectSignals
|
18
|
-
signal_connect('destroy') do
|
19
|
-
closeView
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def closeView
|
24
|
-
@view.close
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
10
|
attr_reader :mainWindow
|
29
11
|
|
30
12
|
def initialize(context, title="No Title")
|
31
13
|
super(context)
|
32
14
|
@mainWindow = MainWindow.new(title, self)
|
33
15
|
@mainWindow.set_default_size(600, 400)
|
34
|
-
@widget = Context::Gtk::Widget.new(@mainWindow)
|
35
16
|
end
|
36
17
|
|
37
18
|
def open
|
38
|
-
|
39
|
-
@mainWindow.grab_focus
|
19
|
+
@mainWindow.open
|
40
20
|
end
|
41
21
|
|
42
22
|
def getWidget
|
43
|
-
@
|
23
|
+
@mainWindow
|
44
24
|
end
|
45
25
|
|
46
26
|
def emitDestroyEvent
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'gtk2'
|
2
|
+
|
3
|
+
module Context::Gtk
|
4
|
+
|
5
|
+
# A Gtk widget representing a main window.
|
6
|
+
# It is simply a Gtk::Window into which you can add new widgets.
|
7
|
+
# You must implement the following methods on the view that
|
8
|
+
# you pass to initialize:
|
9
|
+
#
|
10
|
+
# close() -- closes the view.
|
11
|
+
class MainWindow < Gtk::Window
|
12
|
+
include Context::Gtk::Widget
|
13
|
+
# Create a main window with a given title corresponding to
|
14
|
+
# a Context::View.
|
15
|
+
def initialize(title, view)
|
16
|
+
super(title)
|
17
|
+
@view = view
|
18
|
+
setupWidget
|
19
|
+
isAMainWindow
|
20
|
+
@closed = false
|
21
|
+
connectSignals unless @view.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
# Connect the Gtk signals we care about.
|
25
|
+
def connectSignals
|
26
|
+
signal_connect('destroy') do
|
27
|
+
if !@closed
|
28
|
+
closeView
|
29
|
+
end
|
30
|
+
end
|
31
|
+
signal_connect('delete-event') do
|
32
|
+
if !@closed
|
33
|
+
closeView
|
34
|
+
end
|
35
|
+
true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Explicitly destroy the window through the code rather
|
40
|
+
# than having the window destroyed by pressing the close
|
41
|
+
# button.
|
42
|
+
def explicitDestroy
|
43
|
+
@closed = true
|
44
|
+
self.destroy
|
45
|
+
end
|
46
|
+
|
47
|
+
# Close the view. This is called when the destroy
|
48
|
+
# signal has been emitted.
|
49
|
+
# Note: the View *must* implement close()
|
50
|
+
def closeView
|
51
|
+
@view.close
|
52
|
+
end
|
53
|
+
|
54
|
+
# Context::Gtk::Widget requirements
|
55
|
+
|
56
|
+
# Add a widget to this window.
|
57
|
+
# Note that Gtk::Windows can only add a single item.
|
58
|
+
# If you want to add more items, you will have to make
|
59
|
+
# another widget (like a table or a vbox) and add it to
|
60
|
+
# this one.
|
61
|
+
def gtkAddWidget(widget)
|
62
|
+
add(widget)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Remove the contained widget from this window
|
66
|
+
def gtkRemoveWidget(widget)
|
67
|
+
remove(widget)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'Context/Gtk/Widget'
|
2
|
+
require 'gtk2'
|
3
|
+
|
4
|
+
module Context::Gtk
|
5
|
+
|
6
|
+
# Container class for making vertical lists of widgets.
|
7
|
+
# The primary purpose of this class is to create a container
|
8
|
+
# that respects the packing hints in the Widget mixin.
|
9
|
+
# Something tells me that needing this class means
|
10
|
+
# something is screwed up somewhere...
|
11
|
+
class VBox < Gtk::VBox
|
12
|
+
include Context::Gtk::Widget
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
super
|
16
|
+
setupWidget
|
17
|
+
end
|
18
|
+
|
19
|
+
def gtkAddWidget(widget)
|
20
|
+
pack_start(widget,
|
21
|
+
widget.expandWidgetHeight?,
|
22
|
+
widget.expandWidgetWidth?)
|
23
|
+
end
|
24
|
+
|
25
|
+
def gtkRemoveWidget(widget)
|
26
|
+
remove(widget)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/Context/Widget.rb
CHANGED
@@ -1,40 +1,31 @@
|
|
1
1
|
module Context
|
2
|
+
# This is the Widget mixin for Context. If you wish to be able
|
3
|
+
# to add to, add, or remove a widget inside a View using context,
|
4
|
+
# this mixin must be included. This is an abstract mixin. The
|
5
|
+
# methods do nothing. They should be overriden in the concrete
|
6
|
+
# mixins. Please see Context::Gtk::Widget for an example.
|
7
|
+
module Widget
|
2
8
|
|
3
|
-
|
9
|
+
# This method creates any instance variables that you might have.
|
10
|
+
def setupWidget
|
11
|
+
end
|
4
12
|
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(delegate)
|
8
|
-
@delegate = delegate
|
13
|
+
# Use this widget as a container for the passed widget
|
14
|
+
def addToThisWidget(widget)
|
9
15
|
end
|
10
|
-
|
16
|
+
|
17
|
+
# Remove the passed widget from this object.
|
18
|
+
def removeFromThisWidget(widget)
|
19
|
+
end
|
20
|
+
|
11
21
|
# This method is called after the widget has been
|
12
22
|
# successfully added to another widget
|
13
|
-
def
|
14
|
-
# This is an abstract method, the child classes should
|
15
|
-
# implement this
|
23
|
+
def widgetWasAddedTo(widget)
|
16
24
|
end
|
17
25
|
|
18
26
|
# This method is called after the widget has been
|
19
27
|
# successfully removed from another widget
|
20
|
-
def
|
21
|
-
# This is an abstract method, the child classes should
|
22
|
-
# implement this
|
23
|
-
end
|
24
|
-
|
25
|
-
# Use this widget as a container for the passed widget
|
26
|
-
def add(widget)
|
27
|
-
# This is an abstract method, the child classes should
|
28
|
-
# implement this
|
29
|
-
end
|
30
|
-
|
31
|
-
def remove(widget)
|
32
|
-
# This is an abstract method, the child classes should
|
33
|
-
# implement this
|
34
|
-
end
|
35
|
-
|
36
|
-
def eql?(widget)
|
37
|
-
@delegate.eql?(widget.delegate)
|
28
|
+
def widgetWasRemovedFrom(widget)
|
38
29
|
end
|
39
30
|
end
|
40
31
|
end
|
data/spec/Context/Bridge_spec.rb
CHANGED
@@ -1,36 +1,35 @@
|
|
1
|
+
require 'Context/Spec'
|
1
2
|
require 'Context/Bridge'
|
2
3
|
|
3
|
-
module
|
4
|
-
module Special
|
5
|
-
class Fun
|
6
|
-
end
|
4
|
+
module Context::Spec::BridgeStory
|
7
5
|
|
8
|
-
|
6
|
+
module Other
|
7
|
+
module Special
|
8
|
+
class Fun
|
9
|
+
end
|
10
|
+
|
11
|
+
class In
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
11
|
-
end
|
12
15
|
|
13
|
-
module
|
14
|
-
|
16
|
+
module Special
|
17
|
+
class Fun
|
18
|
+
end
|
15
19
|
end
|
16
|
-
end
|
17
20
|
|
18
|
-
module Context
|
19
21
|
class Fun
|
20
22
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
module Context
|
23
|
+
|
24
|
+
module Excluded
|
25
|
+
class Sun
|
26
|
+
end
|
27
|
+
end
|
29
28
|
|
30
|
-
describe Bridge do
|
29
|
+
describe Context::Bridge do
|
31
30
|
|
32
31
|
it "should reference classes in the namespace provided" do
|
33
|
-
bridge = Bridge.new([Special, Other::Special])
|
32
|
+
bridge = Context::Bridge.new([Special, Other::Special])
|
34
33
|
|
35
34
|
bridge.Fun.should be(Special::Fun)
|
36
35
|
bridge.In.should be(Other::Special::In)
|