Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Create the Kernel namespace using ModuleObject.

  • Loading branch information...
commit 78967a8184587e3614fd6523e0fc460991fd63a1 1 parent 9597e30
@postmodern authored
View
4 lib/yard-contextify/contextify_handler.rb
@@ -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}"
View
6 lib/yard-contextify/legacy/contextify_handler.rb
@@ -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
View
2  spec/contextify_handler_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.