lib/brief/model/definition.rb in brief-1.10.1 vs lib/brief/model/definition.rb in brief-1.11.0

- old
+ new

@@ -7,11 +7,14 @@ :options, :defined_helpers, :defined_actions, :section_mappings, :template_body, - :example_body + :example_body, + :documentation_path, + :example_path, + :template_path def initialize(name, options = {}) @name = name @options = options @type_alias = options.fetch(:type_alias) { name.downcase.parameterize.gsub(/-/, '_') } @@ -64,13 +67,21 @@ end # TODO # There is probably a way to inspect the filename of the code calling you # which would be a better way of handling this that doesn't require - def defined_in(filename=nil) + def defined_in(filename=nil, options={}) if filename filename = Pathname(filename) @doc_options[:defined_in] = filename + + self.example_path ||= options.fetch(:example_path) do + filename.parent.join("..","examples", filename.basename.to_s.gsub('.rb','.md')) + end + + self.documentation_path ||= options.fetch(:documentation_path) do + filename.parent.join("..","documentation", filename.basename.to_s.gsub('.rb','.md')) + end end @doc_options[:defined_in] end