Permalink
Browse files

Create the Kernel namespace using ModuleObject.

  • Loading branch information...
1 parent 9597e30 commit 78967a8184587e3614fd6523e0fc460991fd63a1 @postmodern committed May 7, 2010
@@ -5,14 +5,14 @@ class ContextifyHandler < YARD::Handlers::Ruby::Base
handles method_call(:contextify)
def process
- nobj = namespace
+ nobj = ModuleObject.new(:root, 'Kernel')
mscope = scope
name = statement.parameters[0].first
if name.type == :symbol
name = name.source[1..-1]
- register ModuleObject.new('Kernel', name, :instance) do |o|
+ register MethodObject.new(nobj, name, :instance) do |o|
o.visibility = :public
o.source = statement.source
o.signature = "def #{name}"
@@ -6,15 +6,15 @@ class ContextifyHandler < YARD::Handlers::Ruby::Legacy::Base
handles /\Acontextify\s+:/
def process
- nobj = namespace
+ nobj = ModuleObject.new(:root, 'Kernel')
mscope = scope
name = statement.tokens[2,1].to_s[1..-1]
- register MethodObject.new('Kernel', name, :instance) do |o|
+ register MethodObject.new(nobj, name, :instance) do |o|
o.visibility = :public
o.source = statement.source
o.signature = "def #{name}"
- o.parameters = [['*args', nil]]
+ o.parameters = [['*args', nil], ['&block', nil]]
end
end
@@ -13,7 +13,7 @@
end
it "should register a Kernel method for the class" do
- yard('Kernel#simple_context').should be_instance_of(CodeObjects::ModuleObject)
+ yard('Kernel#simple_context').should be_instance_of(CodeObjects::MethodObject)
end
end

0 comments on commit 78967a8

Please sign in to comment.