Method: Brief::Model::Definition#defined_in

Defined in:
lib/brief/model/definition.rb

#defined_in(filename = nil, options = {}) ⇒ Object

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/brief/model/definition.rb', line 74

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