Class: Module

Inherits:
Object show all
Defined in:
lib/quarry/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#docsObject (readonly)

Returns the value of attribute docs.



6
7
8
# File 'lib/quarry/document.rb', line 6

def docs
  @docs
end

Instance Method Details

#doc(str) ⇒ Object

The idea here is to have dynamic docs.

doc "X does such and such"
doc "it is very powerful"
class X
  doc "f does such and such"
  doc "it is where the power lies"
  def f
    ...
  end
end

One of the great things about doc, is that it can be used to “inherit” documentation.



23
24
25
# File 'lib/quarry/document.rb', line 23

def doc(str)
  $_doc << string
end

#method_added(meth) ⇒ Object



27
28
29
30
31
32
# File 'lib/quarry/document.rb', line 27

def method_added(meth)
  @docs ||= {}
  @docs[self, meth] << $_doc
  $_doc.clear
  nil
end