summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/yard/mruby/code_objects/header_object.rb6
-rw-r--r--spec/code_objects/header_object_spec.rb10
-rw-r--r--spec/code_objects/spec_helper.rb1
-rw-r--r--spec/handlers/c/source/class_handler_spec.rb6
-rw-r--r--spec/handlers/c/source/module_handler_spec.rb6
-rw-r--r--templates/default/fulldoc/html/setup.rb4
-rw-r--r--yard-mruby.gemspec2
7 files changed, 27 insertions, 8 deletions
diff --git a/lib/yard/mruby/code_objects/header_object.rb b/lib/yard/mruby/code_objects/header_object.rb
index 2f9e7e4..45e1f5b 100644
--- a/lib/yard/mruby/code_objects/header_object.rb
+++ b/lib/yard/mruby/code_objects/header_object.rb
@@ -4,11 +4,11 @@ module YARD::MRuby::CodeObjects
# It groups C Functions and define macros.
class HeaderObject < YARD::CodeObjects::NamespaceObject
def functions
- children.find_all {|d| d.is_a?(FunctionObject) }
+ children.find_all {|d| d.is_a?(FunctionObject) }
end
def defines
- children.find_all {|d| d.is_a?(DefineObject) }
+ children.find_all {|d| d.is_a?(DefineObject) }
end
def typedefs
@@ -16,7 +16,7 @@ module YARD::MRuby::CodeObjects
end
def path
- self.name
+ self.name.to_s
end
def title
diff --git a/spec/code_objects/header_object_spec.rb b/spec/code_objects/header_object_spec.rb
new file mode 100644
index 0000000..2e10a70
--- /dev/null
+++ b/spec/code_objects/header_object_spec.rb
@@ -0,0 +1,10 @@
+require_relative 'spec_helper'
+
+describe YARD::MRuby::CodeObjects::HeaderObject do
+ before { Registry.clear }
+
+ it "should return the name of the header for the path" do
+ header_object = YARD::MRuby::CodeObjects::HeaderObject.new(nil, :"mruby.h")
+ expect(header_object.path).to eq("mruby.h")
+ end
+end
diff --git a/spec/code_objects/spec_helper.rb b/spec/code_objects/spec_helper.rb
new file mode 100644
index 0000000..935238d
--- /dev/null
+++ b/spec/code_objects/spec_helper.rb
@@ -0,0 +1 @@
+require_relative '../spec_helper'
diff --git a/spec/handlers/c/source/class_handler_spec.rb b/spec/handlers/c/source/class_handler_spec.rb
index bfac3b6..ac97bc8 100644
--- a/spec/handlers/c/source/class_handler_spec.rb
+++ b/spec/handlers/c/source/class_handler_spec.rb
@@ -8,7 +8,11 @@ describe YARD::MRuby::Handlers::C::Source::ClassHandler do
end
it "should register classes under namespaces" do
- parse_init 'cFoo = mrb_define_class_under(mrb, cBar, "Foo", rb_cObject);'
+ parse_init(<<-eof)
+ cBar = mrb_define_class(mrb, "Bar", mrb->object_class);
+ cFoo = mrb_define_class_under(mrb, cBar, "Foo", rb_cObject);'
+ eof
+
expect(Registry.at('Bar::Foo').type).to be :class
end
diff --git a/spec/handlers/c/source/module_handler_spec.rb b/spec/handlers/c/source/module_handler_spec.rb
index fd08ae6..9641eb3 100644
--- a/spec/handlers/c/source/module_handler_spec.rb
+++ b/spec/handlers/c/source/module_handler_spec.rb
@@ -7,7 +7,11 @@ describe YARD::MRuby::Handlers::C::Source::ModuleHandler do
end
it "should register modules under namespaces" do
- parse_init 'mFoo = mrb_define_module_under(mrb, mBar, "Foo");'
+ parse_init(<<-eof)
+ cBar = mrb_define_module(mrb,"Bar");
+ cFoo = mrb_define_module_under(mrb, cBar, "Foo");
+ eof
+
expect(Registry.at('Bar::Foo').type).to be :module
end
diff --git a/templates/default/fulldoc/html/setup.rb b/templates/default/fulldoc/html/setup.rb
index 43e1e15..0199557 100644
--- a/templates/default/fulldoc/html/setup.rb
+++ b/templates/default/fulldoc/html/setup.rb
@@ -51,12 +51,12 @@ end
# This method removes the namespace from the root node, generates the class list,
# and then adds it back into the root node.
#
-def class_list(root = Registry.root)
+def class_list(root = Registry.root, tree = TreeContext.new)
return super unless root == Registry.root
include_namespace = YARD::MRuby::CodeObjects::HEADERS_ROOT
root.instance_eval { children.delete include_namespace }
- out = super(root)
+ out = super(root, tree)
root.instance_eval { children.push include_namespace }
out
end
diff --git a/yard-mruby.gemspec b/yard-mruby.gemspec
index d768325..aa5326e 100644
--- a/yard-mruby.gemspec
+++ b/yard-mruby.gemspec
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_dependency "yard", "< 0.9.0"
+ spec.add_dependency "yard", ">= 0.9.0"
spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "rake", "~> 10.0"