fancy 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. data/README.md +14 -14
  2. data/Rakefile +16 -4
  3. data/bin/fancy +3 -0
  4. data/bin/fspec +20 -0
  5. data/bin/fyi +27 -11
  6. data/bin/ifancy +1 -1
  7. data/boot/fancy_ext.rb +1 -0
  8. data/boot/fancy_ext/block_env.rb +1 -9
  9. data/boot/fancy_ext/delegator.rb +64 -0
  10. data/boot/fancy_ext/object.rb +4 -0
  11. data/boot/fancy_ext/thread.rb +4 -0
  12. data/boot/load.rb +5 -1
  13. data/boot/rbx-compiler/compiler/ast.rb +0 -1
  14. data/boot/rbx-compiler/compiler/ast/class_def.rb +2 -0
  15. data/boot/rbx-compiler/compiler/ast/method_def.rb +2 -0
  16. data/boot/rbx-compiler/compiler/ast/node.rb +10 -0
  17. data/boot/rbx-compiler/compiler/ast/ruby_args.rb +12 -0
  18. data/boot/rbx-compiler/compiler/ast/singleton_method_def.rb +2 -0
  19. data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
  20. data/boot/rbx-compiler/parser/lexer.lex +5 -11
  21. data/boot/rbx-compiler/parser/parser.rb +16 -5
  22. data/boot/rbx-compiler/parser/parser.y +39 -24
  23. data/doc/api/fancy.css +1 -1
  24. data/doc/api/fancy.jsonp +1 -1
  25. data/doc/api/fdoc.js +22 -4
  26. data/doc/api/index.html +5 -6
  27. data/doc/api/jquery-ui.min.js +401 -0
  28. data/doc/api/jquery.tools.min.js +192 -0
  29. data/doc/api/themeswitchertool.js +250 -0
  30. data/doc/features.md +17 -0
  31. data/examples/actor_bunnies.fy +32 -0
  32. data/examples/actors.fy +26 -0
  33. data/examples/actors_primitive.fy +27 -0
  34. data/examples/actors_ring.fy +37 -0
  35. data/examples/armstrong_numbers.fy +1 -1
  36. data/examples/array.fy +7 -9
  37. data/examples/async_send.fy +1 -2
  38. data/examples/blocks.fy +4 -4
  39. data/examples/call_with_receiver.fy +1 -1
  40. data/examples/class.fy +1 -1
  41. data/examples/default_args.fy +4 -1
  42. data/examples/define_methods.fy +2 -2
  43. data/examples/echo.fy +1 -1
  44. data/examples/factorial.fy +1 -1
  45. data/examples/future_composition.fy +2 -2
  46. data/examples/futures.fy +0 -5
  47. data/examples/game_of_life.fy +1 -1
  48. data/examples/person.fy +1 -1
  49. data/lib/argv.fy +7 -2
  50. data/lib/array.fy +109 -42
  51. data/lib/block.fy +39 -14
  52. data/lib/boot.fy +2 -0
  53. data/lib/class.fy +2 -0
  54. data/lib/compiler/ast.fy +2 -1
  55. data/lib/compiler/ast/assign.fy +2 -3
  56. data/lib/compiler/ast/async_send.fy +1 -15
  57. data/lib/compiler/ast/class_def.fy +2 -1
  58. data/lib/compiler/ast/expression_list.fy +4 -5
  59. data/lib/compiler/ast/future_send.fy +1 -10
  60. data/lib/compiler/ast/goto.fy +46 -0
  61. data/lib/compiler/ast/identifier.fy +9 -7
  62. data/lib/compiler/ast/literals.fy +8 -1
  63. data/lib/compiler/ast/match.fy +14 -4
  64. data/lib/compiler/ast/message_send.fy +34 -6
  65. data/lib/compiler/ast/method_def.fy +6 -6
  66. data/lib/compiler/ast/node.fy +3 -3
  67. data/lib/compiler/ast/range.fy +1 -0
  68. data/lib/compiler/ast/script.fy +0 -2
  69. data/lib/compiler/ast/singleton_method_def.fy +2 -4
  70. data/lib/compiler/ast/string_interpolation.fy +17 -0
  71. data/lib/compiler/ast/super.fy +5 -4
  72. data/lib/compiler/ast/try_catch.fy +8 -6
  73. data/lib/compiler/ast/tuple_literal.fy +3 -2
  74. data/lib/compiler/command.fy +0 -1
  75. data/lib/compiler/compiler.fy +1 -5
  76. data/lib/compiler/stages.fy +6 -14
  77. data/lib/documentation.fy +57 -46
  78. data/lib/enumerable.fy +257 -23
  79. data/lib/enumerator.fy +122 -15
  80. data/lib/false_class.fy +10 -1
  81. data/lib/fancy_spec.fy +263 -61
  82. data/lib/fdoc.fy +11 -25
  83. data/lib/fiber.fy +11 -0
  84. data/lib/file.fy +8 -11
  85. data/lib/future.fy +84 -5
  86. data/lib/hash.fy +65 -14
  87. data/lib/integer.fy +35 -0
  88. data/lib/iteration.fy +54 -29
  89. data/lib/message.fy +6 -0
  90. data/lib/method.fy +0 -16
  91. data/lib/nil_class.fy +58 -8
  92. data/lib/number.fy +49 -22
  93. data/lib/object.fy +371 -65
  94. data/lib/package.fy +24 -1
  95. data/lib/package/installer.fy +5 -9
  96. data/lib/package/specification.fy +2 -2
  97. data/lib/parser/ext/lexer.lex +15 -11
  98. data/lib/parser/ext/parser.y +70 -23
  99. data/lib/parser/methods.fy +33 -14
  100. data/lib/proxy.fy +33 -3
  101. data/lib/range.fy +28 -0
  102. data/lib/rbx.fy +3 -1
  103. data/lib/rbx/actor.fy +53 -0
  104. data/lib/rbx/alpha.fy +31 -0
  105. data/lib/rbx/array.fy +21 -12
  106. data/lib/rbx/bignum.fy +6 -2
  107. data/lib/rbx/block.fy +23 -26
  108. data/lib/rbx/class.fy +54 -2
  109. data/lib/rbx/code_loader.fy +8 -4
  110. data/lib/rbx/date.fy +9 -0
  111. data/lib/rbx/directory.fy +18 -0
  112. data/lib/rbx/environment_variables.fy +1 -0
  113. data/lib/rbx/exception.fy +9 -2
  114. data/lib/rbx/fiber.fy +22 -4
  115. data/lib/rbx/file.fy +5 -5
  116. data/lib/rbx/fixnum.fy +5 -0
  117. data/lib/rbx/float.fy +11 -3
  118. data/lib/rbx/hash.fy +31 -16
  119. data/lib/rbx/integer.fy +1 -0
  120. data/lib/rbx/io.fy +17 -7
  121. data/lib/rbx/match_data.fy +15 -4
  122. data/lib/rbx/method.fy +40 -7
  123. data/lib/rbx/name_error.fy +4 -0
  124. data/lib/rbx/object.fy +92 -24
  125. data/lib/rbx/range.fy +20 -6
  126. data/lib/rbx/regexp.fy +11 -3
  127. data/lib/rbx/string.fy +51 -1
  128. data/lib/rbx/stringio.fy +17 -0
  129. data/lib/rbx/symbol.fy +15 -1
  130. data/lib/rbx/system.fy +20 -2
  131. data/lib/rbx/tcp_server.fy +4 -1
  132. data/lib/rbx/tcp_socket.fy +11 -0
  133. data/lib/rbx/time.fy +6 -0
  134. data/lib/rbx/tuple.fy +14 -5
  135. data/lib/set.fy +144 -29
  136. data/lib/stack.fy +42 -11
  137. data/lib/string.fy +118 -8
  138. data/lib/struct.fy +13 -3
  139. data/lib/symbol.fy +21 -2
  140. data/lib/thread_pool.fy +2 -1
  141. data/lib/true_class.fy +45 -7
  142. data/lib/tuple.fy +27 -9
  143. data/lib/version.fy +2 -2
  144. data/ruby_lib/fancy +43 -0
  145. data/ruby_lib/fdoc +23 -0
  146. data/ruby_lib/fspec +3 -0
  147. data/ruby_lib/fyi +3 -0
  148. data/ruby_lib/ifancy +3 -0
  149. data/tests/argv.fy +5 -9
  150. data/tests/array.fy +323 -196
  151. data/tests/assignment.fy +29 -29
  152. data/tests/block.fy +72 -59
  153. data/tests/class.fy +227 -138
  154. data/tests/control_flow.fy +83 -51
  155. data/tests/documentation.fy +8 -8
  156. data/tests/enumerable.fy +8 -0
  157. data/tests/enumerator.fy +47 -29
  158. data/tests/exception.fy +49 -32
  159. data/tests/file.fy +28 -28
  160. data/tests/fixnum.fy +170 -0
  161. data/tests/future.fy +24 -7
  162. data/tests/hash.fy +55 -38
  163. data/tests/method.fy +50 -43
  164. data/tests/nil_class.fy +37 -37
  165. data/tests/object.fy +152 -70
  166. data/tests/pattern_matching.fy +67 -31
  167. data/tests/range.fy +6 -6
  168. data/tests/set.fy +101 -4
  169. data/tests/stack.fy +14 -5
  170. data/tests/string.fy +115 -61
  171. data/tests/stringio.fy +18 -0
  172. data/tests/struct.fy +27 -0
  173. data/tests/symbol.fy +19 -6
  174. data/tests/true_class.fy +34 -34
  175. data/tests/tuple.fy +30 -12
  176. metadata +103 -81
  177. data/boot/rbx-compiler/compiler/ast/require.rb +0 -20
  178. data/examples/actor.fy +0 -37
  179. data/examples/curl_async.fy +0 -37
  180. data/lib/compiler/ast/require.fy +0 -15
  181. data/tests/number.fy +0 -135
  182. data/tests/parsing/sexp.fy +0 -50
@@ -1,8 +1,9 @@
1
1
  class Fancy AST {
2
-
3
2
  class MethodDef : Rubinius AST Define {
4
- def initialize: @line name: @name args: @arguments body: @body access: @access {
3
+ def initialize: @line name: @name args: @arguments (MethodArgs new: @line) body: @body (ExpressionList new: @line) access: @access ('public) {
4
+ { @body = ExpressionList new: @line } unless: @body
5
5
  @name = @name method_name: nil
6
+ @docstring = @body shift_docstring
6
7
  generate_ivar_assignment
7
8
 
8
9
  if: (@body empty?) then: {
@@ -34,9 +35,8 @@ class Fancy AST {
34
35
  define_method_missing: g
35
36
  }
36
37
 
37
- docstring = @body shift_docstring
38
38
  bytecode(g)
39
- MethodDef set: g docstring: docstring line: @line argnames: $ @arguments names()
39
+ MethodDef set: g docstring: @docstring line: @line argnames: $ @arguments names()
40
40
  }
41
41
 
42
42
  # Sets fancy documentation for the object currently
@@ -77,13 +77,13 @@ class Fancy AST {
77
77
  ms = MessageSend new: @line \
78
78
  message: (Identifier from: "define_forward_method_missing" line: @line) \
79
79
  to: (Self new: @line) \
80
- args: (MessageArgs new: @line args: [])
80
+ args: (MessageArgs new: @line)
81
81
  ms bytecode: g
82
82
  }
83
83
  }
84
84
 
85
85
  class MethodArgs : Rubinius AST FormalArguments {
86
- def initialize: @line args: @array{
86
+ def initialize: @line args: @array ([]) {
87
87
  initialize(@line, @array map() |a| { a to_sym() }, nil, nil)
88
88
  }
89
89
  }
@@ -1,7 +1,7 @@
1
1
  class Fancy AST {
2
-
3
2
  class Node : Rubinius AST Node {
4
- define_method('bytecode) |g| { bytecode: g }
3
+ define_method('bytecode) |g| {
4
+ bytecode: g
5
+ }
5
6
  }
6
-
7
7
  }
@@ -1,6 +1,7 @@
1
1
  class Fancy AST {
2
2
  class RangeLiteral : Node {
3
3
  read_slots: ['from, 'to]
4
+
4
5
  def initialize: @line from: @from to: @to {
5
6
  }
6
7
 
@@ -1,5 +1,4 @@
1
1
  class Fancy AST {
2
-
3
2
  class Script : Node {
4
3
  read_slots: ['file, 'line, 'body]
5
4
 
@@ -48,5 +47,4 @@ class Fancy AST {
48
47
  }
49
48
  }
50
49
  }
51
-
52
50
  }
@@ -1,6 +1,5 @@
1
1
  class Fancy AST {
2
2
  class SingletonMethodDef : Rubinius AST DefineSingleton {
3
-
4
3
  def initialize: @line name: @name args: @arguments body: @body access: @access owner: @receiver {
5
4
  name = @name method_name: @receiver
6
5
  @body = SingletonMethodDefScope new: @line name: name args: @arguments body: @body
@@ -13,12 +12,11 @@ class Fancy AST {
13
12
  g pop()
14
13
  bytecode(g)
15
14
  }
16
-
17
15
  }
18
16
 
19
17
  class SingletonMethodDefScope : Rubinius AST DefineSingletonScope {
20
-
21
- def initialize: @line name: @name args: @arguments body: @body { }
18
+ def initialize: @line name: @name args: @arguments body: @body {
19
+ }
22
20
 
23
21
  define_method("bytecode") |g, recv| {
24
22
  bytecode: g receiver: recv
@@ -0,0 +1,17 @@
1
+ class Fancy AST {
2
+ class StringInterpolation : Node {
3
+ """
4
+ StringInterpolation nodes need to be parsed after the overall code has been parsed
5
+ as the parser currently isn't re-entrant.
6
+ It works...
7
+ """
8
+
9
+ def initialize: @line code: @code
10
+ def parse_code {
11
+ Fancy Parser parse_code: @code file: ("<<StringInterpolation: " ++ (@code inspect) ++ ">>") line: @line
12
+ }
13
+ def bytecode: g {
14
+ parse_code body expressions first bytecode: g
15
+ }
16
+ }
17
+ }
@@ -1,11 +1,13 @@
1
1
  class Fancy AST {
2
-
3
2
  class Super : Node {
4
- def initialize: @line { }
3
+ def initialize: @line {
4
+ }
5
5
  }
6
6
 
7
7
  class SuperSend : Node {
8
- def initialize: @line message: @name args: @args { }
8
+ def initialize: @line message: @name args: @args {
9
+ }
10
+
9
11
  def bytecode: g {
10
12
  pos(g)
11
13
  @args bytecode: g
@@ -14,5 +16,4 @@ class Fancy AST {
14
16
  g send_super(name, @args size)
15
17
  }
16
18
  }
17
-
18
19
  }
@@ -1,6 +1,5 @@
1
1
  class Fancy AST {
2
2
  class TryCatch : Node {
3
-
4
3
  def initialize: @line body: @body handlers: @handlers ensure: @ensure {
5
4
  if: (@body empty?) then: {
6
5
  @body unshift_expression: $ NilLiteral new: @line
@@ -12,7 +11,6 @@ class Fancy AST {
12
11
 
13
12
  g push_modifiers()
14
13
 
15
-
16
14
  outer_retry = g new_label()
17
15
  this_retry = g new_label()
18
16
  reraise = g new_label()
@@ -133,7 +131,8 @@ class Fancy AST {
133
131
  }
134
132
 
135
133
  class ExceptionHandler : Node {
136
- def initialize: @line condition: @condition var: @var body: @body {}
134
+ def initialize: @line condition: @condition var: @var body: @body {
135
+ }
137
136
 
138
137
  def bytecode: g final_tag: final_tag {
139
138
  pos(g)
@@ -161,7 +160,9 @@ class Fancy AST {
161
160
  }
162
161
 
163
162
  class CurrentException : Node {
164
- def initialize: @line {}
163
+ def initialize: @line {
164
+ }
165
+
165
166
  def bytecode: g {
166
167
  pos(g)
167
168
  g push_current_exception()
@@ -169,12 +170,13 @@ class Fancy AST {
169
170
  }
170
171
 
171
172
  class Retry : Node {
172
- def initialize: @line {}
173
+ def initialize: @line {
174
+ }
175
+
173
176
  def bytecode: g {
174
177
  pos(g)
175
178
  g pop()
176
179
  g goto(g retry())
177
180
  }
178
181
  }
179
-
180
182
  }
@@ -1,6 +1,7 @@
1
1
  class Fancy AST {
2
2
  class TupleLiteral : Node {
3
- def initialize: @line entries: @elements { }
3
+ def initialize: @line entries: @elements {
4
+ }
4
5
 
5
6
  def bytecode: g {
6
7
  pos(g)
@@ -22,7 +23,7 @@ class Fancy AST {
22
23
  ary = [FixnumLiteral new: @line value: i, e]
23
24
 
24
25
  ms = MessageSend new: @line \
25
- message: (Identifier from: "at:put:" line: @line) \
26
+ message: (Identifier from: "[]:" line: @line) \
26
27
  to: (Nothing new: @line) \
27
28
  args: (MessageArgs new: @line args: ary)
28
29
 
@@ -2,7 +2,6 @@ require("fileutils")
2
2
 
3
3
  class Fancy {
4
4
  class Compiler Command {
5
-
6
5
  def self option: argv flag: name {
7
6
  argv delete(name)
8
7
  }
@@ -1,8 +1,6 @@
1
1
  class Fancy {
2
-
3
2
  class Compiler : Rubinius Compiler {
4
-
5
- read_write_slots: ['parser, 'generator, 'packager, 'writer]
3
+ read_write_slots: [ 'parser, 'generator, 'packager, 'writer ]
6
4
 
7
5
  def self compiled_name: file {
8
6
  """
@@ -69,7 +67,5 @@ class Fancy {
69
67
  compiler_error("Error trying to compile " ++ file, e)
70
68
  }
71
69
  }
72
-
73
70
  }
74
-
75
71
  }
@@ -1,7 +1,5 @@
1
1
  class Fancy Compiler Stages {
2
-
3
2
  class Stage : Rubinius Compiler Stage {
4
-
5
3
  initialize = |compiler, last| {
6
4
  sup = Rubinius Compiler Stage instance_method('initialize)
7
5
  sup bind(self) call(compiler, last)
@@ -16,14 +14,11 @@ class Fancy Compiler Stages {
16
14
 
17
15
  run = { self run; run_next() }
18
16
  define_method('run, &run)
19
-
20
17
  }
21
18
 
22
19
  class FancyGenerator : Stage {
23
-
24
20
  stage: 'fancy_bytecode next: Rubinius Compiler Encoder
25
-
26
- read_write_slots: ['variable_scope]
21
+ read_write_slot: 'variable_scope
27
22
 
28
23
  def initialize: compiler last: last {
29
24
  @variable_scope = nil
@@ -36,7 +31,6 @@ class Fancy Compiler Stages {
36
31
  @input bytecode(@output)
37
32
  @output close()
38
33
  }
39
-
40
34
  }
41
35
 
42
36
  class FancyCodeParser : Stage {
@@ -47,7 +41,8 @@ class Fancy Compiler Stages {
47
41
  compiler parser: self
48
42
  }
49
43
 
50
- def input: @code file: @filename line: @line (1) {}
44
+ def input: @code file: @filename line: @line (1) {
45
+ }
51
46
 
52
47
  def run {
53
48
  ast = Fancy Parser parse_code: @code file: @filename line: @line
@@ -58,7 +53,6 @@ class Fancy Compiler Stages {
58
53
  }
59
54
 
60
55
  class FancyFileParser : Stage {
61
-
62
56
  stage: 'fancy_file next: FancyGenerator
63
57
  read_write_slots: ['root, 'print]
64
58
 
@@ -66,7 +60,8 @@ class Fancy Compiler Stages {
66
60
  compiler parser: self
67
61
  }
68
62
 
69
- def input: @filename line: @line (1) {}
63
+ def input: @filename line: @line (1) {
64
+ }
70
65
 
71
66
  def run {
72
67
  ast = Fancy Parser parse_file: @filename line: @line
@@ -74,8 +69,5 @@ class Fancy Compiler Stages {
74
69
  @output = @root new(ast)
75
70
  @output file=(@filename)
76
71
  }
77
-
78
72
  }
79
-
80
- }
81
-
73
+ }
@@ -1,57 +1,60 @@
1
1
  class Fancy Documentation {
2
-
3
2
  """
4
- A Fancy Documentation object is a holder for docstrings and specs.
5
- Keeps a registry of documentation for anything Fancy.
3
+ A Fancy Documentation object is a holder for docstrings and specs.
4
+ Keeps a registry of documentation for anything Fancy.
6
5
 
7
- Provides methods for searching and formatting objects' docstrings
8
- this can be be handy for users of interactive Fancy REPL,
9
- document generators, instrospection toos, IDEs, anything!.
6
+ Provides methods for searching and formatting an Object's docstrings.
7
+ This can be be handy for users of the interactive Fancy REPL,
8
+ document generators, instrospection tools, IDEs, anything!
10
9
 
11
- This object can be converted to just anything by using its format:
12
- method. formatters can be registered with Fancy Documentation formatter:is:
10
+ This object can be converted to just anything by using its format:
11
+ method. Formatters can be registered with Fancy Documentation#formatter:is:
13
12
 
14
- By default two formatters are defined:
13
+ By default two formatters are defined:
15
14
 
16
- 'fancy => Returns the Fancy::Documentation object
17
- 'string => Returns the docs string representation
15
+ 'fancy => Returns the Fancy::Documentation object
16
+ 'string => Returns the docs string representation
18
17
  """
18
+
19
19
  read_write_slots: ['object, 'docs, 'specs]
20
20
 
21
21
  instance_method: 'docs . executable() . documentation: """
22
- An array of docstrings for the object beind documented.
22
+ An array of docstrings for the object beind documented.
23
23
 
24
- We have an array of docstrings because in Fancy, some
25
- things like classes can be re-openned and the user may
26
- specify new documentation for it each time. Thus we dont
27
- want to loose the previous documentation but rather build
28
- upon it. That is, fancy supports incremental documentation.
24
+ We have an array of docstrings because in Fancy, some
25
+ things like classes can be re-openned and the user may
26
+ specify new documentation for it each time. Thus we dont
27
+ want to loose the previous documentation but rather build
28
+ upon it. That is, fancy supports incremental documentation.
29
29
  """
30
30
 
31
31
  instance_method: 'specs . documentation: """
32
- An array of associated Fancy specs for the object
33
- being documented.
34
-
35
- Its a lot better to keep the associated specs in
36
- Fancy Documentation objects instead of just having them
37
- in method instances. This allows us to associate any object
38
- with an spec example.
39
-
40
- This way you can have a single Fancy spec example that
41
- is related to many objects (methods, constants, classes)
42
- that are being specified. Later in documentation, we can
43
- provide links to all specs where an object is being exercised.
32
+ An array of associated Fancy specs for the object
33
+ being documented.
34
+
35
+ Its a lot better to keep the associated specs in
36
+ Fancy Documentation objects instead of just having them
37
+ in method instances. This allows us to associate any object
38
+ with an spec example.
39
+
40
+ This way you can have a single Fancy spec example that
41
+ is related to many objects (methods, constants, classes)
42
+ that are being specified. Later in documentation, we can
43
+ provide links to all specs where an object is being exercised.
44
44
  """
45
45
 
46
- def to_s { @docs join: "\n" }
46
+ def to_s {
47
+ @docs join: "\n" . skip_leading_indentation
48
+ }
47
49
 
48
50
  def format: format {
49
51
  """
50
- If format is specified, the documentation string will be
51
- converted using the corresponding formatter. This allows
52
- you to extend Fancy documentation system, and produce
53
- html documents, man pages, or anything you can imagine.
52
+ If format is specified, the documentation string will be
53
+ converted using the corresponding formatter. This allows
54
+ you to extend Fancy documentation system, and produce
55
+ html documents, man pages, or anything you can imagine.
54
56
  """
57
+
55
58
  formatter = Fancy Documentation formatter: format
56
59
  { "No such documentation format: " ++ format . raise! } unless: formatter
57
60
  formatter call: [self]
@@ -59,9 +62,10 @@ class Fancy Documentation {
59
62
 
60
63
  def self for: obj append: docstring {
61
64
  """
62
- Append docstring to the documentation for obj.
63
- If obj has no documentation, one is created for it.
65
+ Append docstring to the documentation for obj.
66
+ If obj has no documentation, one is created for it.
64
67
  """
68
+
65
69
  doc = for: obj
66
70
  if: doc then: {
67
71
  doc docs << docstring
@@ -72,17 +76,26 @@ class Fancy Documentation {
72
76
  }
73
77
 
74
78
  def self formatter: name {
75
- "Obtain a formatter by the given name. Returns a callable object"
79
+ """
80
+ Obtains a formatter by a given name. Returns a callable object.
81
+ """
82
+
76
83
  formatters at: name
77
84
  }
78
85
 
79
86
  def self formatter: name is: callable {
80
- "Register a callable object as formatter under name."
81
- formatters at: name put: callable
87
+ """
88
+ Registers a callable object as formatter under name.
89
+ """
90
+
91
+ formatters[name]: callable
82
92
  }
83
93
 
84
94
  def self formatters {
85
- "Obtain the hash of known documentation formatters."
95
+ """
96
+ Obtain the hash of known documentation formatters.
97
+ """
98
+
86
99
  unless: @formatters do: { @formatters = <[]> }
87
100
  @formatters
88
101
  }
@@ -92,12 +105,13 @@ class Fancy Documentation {
92
105
 
93
106
  # TODO: implement. Plain is just like string but including spec names.
94
107
  self formatter: 'plain is: |doc| { doc to_s }
95
-
96
108
  }
97
109
 
98
110
  class Fancy Documentation RDiscount {
111
+ """
112
+ A documentation formatter using ruby's RDiscount markdown
113
+ """
99
114
 
100
- "A documentation formatter using ruby's RDiscount markdown"
101
115
  Fancy Documentation formatter: 'rdiscount is: |d| { rdiscount: d }
102
116
 
103
117
  # Register as default markdown formatter.
@@ -109,7 +123,4 @@ class Fancy Documentation RDiscount {
109
123
  require("rdiscount")
110
124
  RDiscount.new(doc to_s).to_html()
111
125
  }
112
-
113
- }
114
-
115
-
126
+ }