Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 1bc9beb61318a38e29939edc41cdb788cace29eb Nikolai Weibull committed Apr 6, 2012
@@ -0,0 +1 @@
+*.gem
@@ -0,0 +1,7 @@
+ YARD Method Overrides
+
+ A YARD plugin that adds tags for specifying method overrides. The tags added
+ are @extension and @override, which allow you to tag a method as either an
+ extension of a superclass’ definition or a complete override of a superclass’
+ definition. This makes it easy for the reader to see what’s going on may
+ read up on what may be going on in the superclass.
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+require 'inventory/rake/tasks'
+
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'yard-method-overrides/version'
+
+Inventory::Rake::Tasks.define YardMethodOverrides::Version, :gem => proc{ |_, s|
+ s.author = 'Nikolai Weibull'
+ s.email = 'now@bitwi.se'
+ s.homepage = 'https://github.com/now/yard-method-overrides'
+
+ s.add_runtime_dependency 'inventory', '~> 0.2.0'
+ s.add_runtime_dependency 'yard', '~> 0.7.0'
+}
@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+
+YARD::Templates::Engine.register_template_path File.expand_path('../../templates', __FILE__)
+YARD::Tags::Library.define_tag 'Extending Method', :extension
+YARD::Tags::Library.define_tag 'Overriding Method', :override
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+require 'inventory'
+
+module YardMethodOverrides
+ Version = Inventory.new(0, 1, 0){
+ def additional_files
+ %w'
+ templates/default/tags/html/extension.erb
+ templates/default/tags/html/override.erb
+ templates/default/tags/setup.rb
+ '
+ end
+
+ def unit_tests
+ []
+ end
+ }
+end
@@ -0,0 +1 @@
+<p>This method is an extension of <%= linkify(object.overridden_method) %>.</p>
@@ -0,0 +1 @@
+<p>This method overrides <%= linkify(object.overridden_method) %>.</p>
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+def init
+ sections.push :extension, :override
+end
+
+def extension
+ erb(:extension) if object.has_tag? :extension and object.respond_to? :overridden_method and object.overridden_method
+end
+
+def override
+ erb(:override) if object.has_tag? :override and object.respond_to? :overridden_method and object.overridden_method
+end

0 comments on commit 1bc9beb

Please sign in to comment.