yard-markdown 0.3.6 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/example/Aquatic.md +18 -0
- data/example/Fish.md +33 -0
- data/example/Salmon.md +56 -0
- data/example/index.csv +19 -20
- data/example_yard.rb +145 -0
- data/templates/default/fulldoc/markdown/setup.rb +55 -10
- metadata +7 -6
- data/example/Bird.md +0 -38
- data/example/Duck.md +0 -57
- data/example/Waterfowl.md +0 -19
- /data/{example.rb → example_rdoc.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56b8294ee2ef9bdd12b36f03b4260286e34d2002363a4f9cd280af85743c342c
|
4
|
+
data.tar.gz: f8df2867ca6d8c98aa79a20585d181b79ed12a507637b948708010ae2930ffe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d814cb9ac75d6330b72bbd53087fbc417392aa44296944da168f4195b7d92a9d60ff5e5e40d233ad628763c2c7d9cdb9c99213dde740dd54478791fce1bdacd
|
7
|
+
data.tar.gz: 1aba7f70acf91dca5f5b2a829160ff255a60a598360ccfce492d6cd2096a3d110095fb1eac6bf38138fab808ed98cc6b8b517598acd71a69cc658e235b47012e
|
data/README.md
CHANGED
@@ -6,7 +6,6 @@ Yard plugin to generate markdown documentation
|
|
6
6
|
- Compatible with Github Flavored Markdown
|
7
7
|
- Mimick yard html layout where it makes sense to maintain familiarity
|
8
8
|
- Produce .csv index file alonside markdown documentation to act as file index
|
9
|
-
- Include markdown files that are already present in source code.
|
10
9
|
|
11
10
|
## Usage
|
12
11
|
Yard doesn't load plugin by default, so you need to load plugin through `~/.yard/config`:
|
@@ -26,9 +25,13 @@ gem install yard-markdown
|
|
26
25
|
Run `yardoc --format=markdown` to generate markdown documentation.
|
27
26
|
|
28
27
|
## Backstory
|
29
|
-
This is a successor to [rdoc-mardown gem](https://github.com/skatkov/rdoc-markdown/tree/main/example)
|
28
|
+
This is a successor to [rdoc-mardown gem](https://github.com/skatkov/rdoc-markdown/tree/main/example). These docsets are used in [POSH TUI](https://poshtui.com).
|
30
29
|
|
31
30
|
## Testing
|
32
31
|
Unit tests can't really test this gem properly. So it's semi-manual process of making changes and reviewing output.
|
33
32
|
|
34
|
-
|
33
|
+
### Testing Rdoc conversion to markdown:
|
34
|
+
`yardoc example_rdoc.rb` -> outputs everything into example/ folder.
|
35
|
+
|
36
|
+
### Testing Yard conversion to markdown:
|
37
|
+
`yardoc example_yard.rb` -> outputs everything into example/ folder.
|
data/example/Aquatic.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Module: Aquatic
|
2
|
+
|
3
|
+
**Defined in:** example_yard.rb
|
4
|
+
|
5
|
+
A mixin for aquatic creatures.
|
6
|
+
|
7
|
+
# Public Instance Methods
|
8
|
+
## swim() [](#method-i-swim)
|
9
|
+
Swim in the water.
|
10
|
+
|
11
|
+
**@return** [void]
|
12
|
+
|
13
|
+
|
14
|
+
# Constants
|
15
|
+
| Name | Default Value |
|
16
|
+
| --- | --- |
|
17
|
+
| [DEFAULT_SALMON_SPEED](#constant-DEFAULT_SALMON_SPEED) | 20 |
|
18
|
+
| [MAX_DEPTH](#constant-MAX_DEPTH) | 500 |
|
data/example/Fish.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Class: Fish
|
2
|
+
**Inherits:** Object
|
3
|
+
|
4
|
+
**Defined in:** example_yard.rb
|
5
|
+
|
6
|
+
The base class for all fish.
|
7
|
+
|
8
|
+
# Public Instance Methods
|
9
|
+
## make_sound() [](#method-i-make_sound)
|
10
|
+
Make a sound.
|
11
|
+
|
12
|
+
**@return** [void]
|
13
|
+
**@yield** [sound] The sound produced by the fish
|
14
|
+
**@yieldparam** [String] The actual sound
|
15
|
+
## swim(direction, speed) [](#method-i-swim)
|
16
|
+
Swim in a specific direction.
|
17
|
+
|
18
|
+
Swimming is the most critical feature of fish.
|
19
|
+
|
20
|
+
**@param** [Symbol, String] The direction to swim
|
21
|
+
**@param** [Integer] The speed at which to swim
|
22
|
+
**@return** [Boolean] Whether the swim was successful
|
23
|
+
|
24
|
+
**@example**
|
25
|
+
```ruby
|
26
|
+
swim(:north, 30)
|
27
|
+
```
|
28
|
+
|
29
|
+
# Constants
|
30
|
+
| Name | Default Value |
|
31
|
+
| --- | --- |
|
32
|
+
| [DEFAULT_SALMON_SPEED](#constant-DEFAULT_SALMON_SPEED) | 20 |
|
33
|
+
| [MAX_DEPTH](#constant-MAX_DEPTH) | 500 |
|
data/example/Salmon.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Class: Salmon
|
2
|
+
**Inherits:** Fish
|
3
|
+
|
4
|
+
**Includes:** Aquatic
|
5
|
+
|
6
|
+
**Defined in:** example_yard.rb
|
7
|
+
|
8
|
+
A salmon is an Aquatic Fish.
|
9
|
+
|
10
|
+
## Features
|
11
|
+
|
12
|
+
* **Fish**
|
13
|
+
* make_sound
|
14
|
+
* swim
|
15
|
+
* **Aquatic**
|
16
|
+
* swim (overridden)
|
17
|
+
|
18
|
+
# Public Instance Methods
|
19
|
+
## initialize(farmed, wild) [](#method-i-initialize)
|
20
|
+
Creates a new salmon.
|
21
|
+
|
22
|
+
**@param** [Boolean] Whether the salmon is farmed
|
23
|
+
**@param** [Boolean] Whether the salmon is wild
|
24
|
+
**@return** [Salmon] a new instance of Salmon
|
25
|
+
## make_sound() [](#method-i-make_sound)
|
26
|
+
Salmon overrides generic implementation.
|
27
|
+
|
28
|
+
**@return** [void]
|
29
|
+
**@yield** [sound] The sound produced by the salmon
|
30
|
+
**@yieldparam** [String] The actual sound
|
31
|
+
## sustainable?() [](#method-i-sustainable?)
|
32
|
+
Checks if this salmon is sustainable.
|
33
|
+
|
34
|
+
**@return** [Boolean] Whether the salmon is sustainable
|
35
|
+
## swim() [](#method-i-swim)
|
36
|
+
Swim in the water.
|
37
|
+
|
38
|
+
**@return** [void]
|
39
|
+
|
40
|
+
# Public Class Methods
|
41
|
+
## wild_salmon() [](#method-c-wild_salmon)
|
42
|
+
**@return** [Array<Salmon>] List of all wild salmon
|
43
|
+
|
44
|
+
# Attributes
|
45
|
+
## farmed[RW] [](#attribute-i-farmed)
|
46
|
+
|
47
|
+
**@return** [Boolean] True for farmed salmon
|
48
|
+
## wild[RW] [](#attribute-i-wild)
|
49
|
+
|
50
|
+
**@return** [Boolean] True for wild salmon
|
51
|
+
|
52
|
+
# Constants
|
53
|
+
| Name | Default Value |
|
54
|
+
| --- | --- |
|
55
|
+
| [DEFAULT_SALMON_SPEED](#constant-DEFAULT_SALMON_SPEED) | 20 |
|
56
|
+
| [MAX_DEPTH](#constant-MAX_DEPTH) | 500 |
|
data/example/index.csv
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
name,type,path
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rubber,Attribute,Duck.md#attribute-i-rubber
|
2
|
+
Aquatic,Module,Aquatic.md
|
3
|
+
Aquatic.DEFAULT_SALMON_SPEED,Constant,Aquatic.md#constant-DEFAULT_SALMON_SPEED
|
4
|
+
Aquatic.MAX_DEPTH,Constant,Aquatic.md#constant-MAX_DEPTH
|
5
|
+
Aquatic.swim,Method,Aquatic.md#method-i-swim
|
6
|
+
Fish,Class,Fish.md
|
7
|
+
Fish.DEFAULT_SALMON_SPEED,Constant,Fish.md#constant-DEFAULT_SALMON_SPEED
|
8
|
+
Fish.MAX_DEPTH,Constant,Fish.md#constant-MAX_DEPTH
|
9
|
+
Fish.make_sound,Method,Fish.md#method-i-make_sound
|
10
|
+
Fish.swim,Method,Fish.md#method-i-swim
|
11
|
+
Salmon,Class,Salmon.md
|
12
|
+
Salmon.DEFAULT_SALMON_SPEED,Constant,Salmon.md#constant-DEFAULT_SALMON_SPEED
|
13
|
+
Salmon.MAX_DEPTH,Constant,Salmon.md#constant-MAX_DEPTH
|
14
|
+
Salmon.initialize,Method,Salmon.md#method-i-initialize
|
15
|
+
Salmon.make_sound,Method,Salmon.md#method-i-make_sound
|
16
|
+
Salmon.sustainable?,Method,Salmon.md#method-i-sustainable?
|
17
|
+
Salmon.swim,Method,Salmon.md#method-i-swim
|
18
|
+
Salmon.wild_salmon,Method,Salmon.md#method-c-wild_salmon
|
19
|
+
farmed,Attribute,Salmon.md#attribute-i-farmed
|
20
|
+
wild,Attribute,Salmon.md#attribute-i-wild
|
data/example_yard.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
# A mixin for aquatic creatures.
|
2
|
+
#
|
3
|
+
module Aquatic
|
4
|
+
# Swim in the water.
|
5
|
+
#
|
6
|
+
# @return [void]
|
7
|
+
def swim
|
8
|
+
puts "swimming in the water"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# The base class for all fish.
|
13
|
+
class Fish
|
14
|
+
# Make a sound.
|
15
|
+
#
|
16
|
+
# @yield [sound] The sound produced by the fish
|
17
|
+
# @yieldparam sound [String] The actual sound
|
18
|
+
# @return [void]
|
19
|
+
def make_sound
|
20
|
+
puts "generic bubbling"
|
21
|
+
yield "blub"
|
22
|
+
yield "blub"
|
23
|
+
end
|
24
|
+
|
25
|
+
# Swim in a specific direction.
|
26
|
+
#
|
27
|
+
# Swimming is the most critical feature of fish.
|
28
|
+
#
|
29
|
+
# @param direction [Symbol, String] The direction to swim
|
30
|
+
# @param speed [Integer] The speed at which to swim
|
31
|
+
# @return [Boolean] Whether the swim was successful
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# swim(:north, 30)
|
35
|
+
def swim(direction, speed)
|
36
|
+
_swim_impl(direction, speed)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# @!visibility private
|
42
|
+
def _swim_impl(direction, speed)
|
43
|
+
puts "swimming away: direction=#{direction}, speed=#{speed}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# A salmon is an Aquatic Fish.
|
48
|
+
#
|
49
|
+
# ## Features
|
50
|
+
#
|
51
|
+
# - **Fish**
|
52
|
+
# - make_sound
|
53
|
+
# - swim
|
54
|
+
# - **Aquatic**
|
55
|
+
# - swim (overridden)
|
56
|
+
class Salmon < Fish
|
57
|
+
include Aquatic
|
58
|
+
|
59
|
+
# @!group Fish overrides
|
60
|
+
|
61
|
+
# Salmon overrides generic implementation.
|
62
|
+
#
|
63
|
+
# @yield [sound] The sound produced by the salmon
|
64
|
+
# @yieldparam sound [String] The actual sound
|
65
|
+
# @return [void]
|
66
|
+
def make_sound
|
67
|
+
sound = splash
|
68
|
+
yield sound
|
69
|
+
end
|
70
|
+
|
71
|
+
# Implements splashing
|
72
|
+
#
|
73
|
+
# @return [String] The splash sound
|
74
|
+
def splash
|
75
|
+
"splash"
|
76
|
+
end
|
77
|
+
|
78
|
+
private :splash
|
79
|
+
|
80
|
+
# @!endgroup
|
81
|
+
|
82
|
+
# @!group Salmon specific attributes
|
83
|
+
|
84
|
+
# @return [Boolean] True for farmed salmon
|
85
|
+
attr_accessor :farmed
|
86
|
+
|
87
|
+
# @return [Boolean] True for wild salmon
|
88
|
+
attr_reader :wild
|
89
|
+
|
90
|
+
# @return [Integer] Maximum speed for a swimming salmon
|
91
|
+
MAX_SPEED = 40
|
92
|
+
|
93
|
+
# @!endgroup
|
94
|
+
|
95
|
+
# Global list of all wild salmon.
|
96
|
+
#
|
97
|
+
# Use for conservation efforts.
|
98
|
+
@@wild_salmon = []
|
99
|
+
|
100
|
+
# @return [Array<Salmon>] List of all wild salmon
|
101
|
+
def self.wild_salmon
|
102
|
+
@@wild_salmon
|
103
|
+
end
|
104
|
+
|
105
|
+
# Creates a new salmon.
|
106
|
+
#
|
107
|
+
# @param farmed [Boolean] Whether the salmon is farmed
|
108
|
+
# @param wild [Boolean] Whether the salmon is wild
|
109
|
+
def initialize(farmed, wild)
|
110
|
+
@farmed = farmed
|
111
|
+
@wild = wild
|
112
|
+
@@wild_salmon << self if wild
|
113
|
+
end
|
114
|
+
|
115
|
+
# Checks if this salmon is sustainable.
|
116
|
+
#
|
117
|
+
# @return [Boolean] Whether the salmon is sustainable
|
118
|
+
def sustainable?
|
119
|
+
@wild || (@farmed && environmentally_friendly?)
|
120
|
+
end
|
121
|
+
|
122
|
+
private
|
123
|
+
|
124
|
+
# @return [Boolean] Whether farming practices are environmentally friendly
|
125
|
+
def environmentally_friendly?
|
126
|
+
# Implementation details...
|
127
|
+
true
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Default speed for a swimming salmon
|
132
|
+
DEFAULT_SALMON_SPEED = 20
|
133
|
+
|
134
|
+
# Maximum depth for salmon habitat
|
135
|
+
MAX_DEPTH = 500
|
136
|
+
|
137
|
+
# Default wild salmon.
|
138
|
+
#
|
139
|
+
# @note Global variables should be used sparingly, but this is for demonstration.
|
140
|
+
$default_wild_salmon = Salmon.new(false, true)
|
141
|
+
|
142
|
+
# Farmed sustainable salmon.
|
143
|
+
#
|
144
|
+
# @note This is just a local variable for demonstration purposes.
|
145
|
+
farmed_sustainable_salmon = Salmon.new(true, false)
|
@@ -90,6 +90,10 @@ def serialize_index(objects)
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
# @param object [YARD::CodeObjects::Base]
|
94
|
+
# @return [String] markdown formatted string
|
95
|
+
#
|
96
|
+
# @todo Extract template out of setup.rb class.
|
93
97
|
def serialize(object)
|
94
98
|
template =
|
95
99
|
ERB.new(
|
@@ -106,12 +110,14 @@ def serialize(object)
|
|
106
110
|
|
107
111
|
<%= rdoc_to_md object.docstring %>
|
108
112
|
|
113
|
+
<%= render_tags object %>
|
109
114
|
<% if (insmeths = public_instance_methods(object)).size > 0 %>
|
110
115
|
# Public Instance Methods
|
111
116
|
<% insmeths.each do |item| %>
|
112
117
|
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join("") }.join(", ")%>) [](#<%=aref(item)%>)
|
113
118
|
<%= rdoc_to_md item.docstring %>
|
114
119
|
|
120
|
+
<%= render_tags item %>
|
115
121
|
<% end %><% end %>
|
116
122
|
|
117
123
|
<% if (pubmeths = public_class_methods(object)).size > 0 %>
|
@@ -119,26 +125,25 @@ def serialize(object)
|
|
119
125
|
<% pubmeths.each do |item| %>
|
120
126
|
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join(" ") }.join(", ") %>) [](#<%=aref(item)%>)
|
121
127
|
<%= rdoc_to_md item.docstring %>
|
122
|
-
|
123
|
-
<% end %>
|
124
|
-
<% end %>
|
128
|
+
<%= render_tags item %>
|
129
|
+
<% end %><% end %>
|
125
130
|
<% if (attrs = attr_listing(object)).size > 0 %>
|
126
131
|
# Attributes
|
127
132
|
<% attrs.each do |item|%>
|
128
133
|
## <%= item.name %><%= item.reader? ? "[RW]" : "[R]" %> [](#<%=aref(item)%>)
|
129
134
|
<%= rdoc_to_md item.docstring %>
|
130
135
|
|
131
|
-
|
132
|
-
<% end %>
|
133
|
-
|
136
|
+
<%= render_tags item %>
|
137
|
+
<% end %><% end %>
|
134
138
|
<% if constant_listing.size > 0 %>
|
135
139
|
<% groups(constant_listing, "Constants") do |list, name| %>
|
136
140
|
# <%= name %>
|
141
|
+
<% if list.size > 0 %>
|
142
|
+
| Name | Default Value |
|
143
|
+
| --- | --- |
|
137
144
|
<% list.each do |cnst| %>
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
<% end %><% end %><% end %>',
|
145
|
+
| [<%= cnst.name %>](#<%=aref(cnst)%>) | <%= cnst.value %> |
|
146
|
+
<% end %><% end %><% end %><% end %>',
|
142
147
|
trim_mode: "<>",
|
143
148
|
)
|
144
149
|
|
@@ -147,10 +152,50 @@ end
|
|
147
152
|
|
148
153
|
require "rdoc"
|
149
154
|
|
155
|
+
##
|
156
|
+
# Converts rdoc to markdown.
|
157
|
+
#
|
158
|
+
# I didn't found a way to detect yard/rdoc docstrings, so we're running docstrings through rdoc to markdown converter in all cases. If it's yard docstring, it doesn't seem to have any negative effect on end results. But absense of bugs, doesn't mean that there are no issues.
|
159
|
+
#
|
160
|
+
# @param docstring [String, YARD::Docstring]
|
161
|
+
# @return [String] markdown formatted string
|
150
162
|
def rdoc_to_md(docstring)
|
151
163
|
RDoc::Markup::ToMarkdown.new.convert(docstring)
|
152
164
|
end
|
153
165
|
|
166
|
+
##
|
167
|
+
# Formats yard tags belonging to a object.
|
168
|
+
#
|
169
|
+
# This is mostly a feature of yard and rdoc doesn't have any of that. Rdoc supports ":nodoc:" and other tags. Yard claims to have full support for rdoc, doesn't really handle tags like ":nodoc:" or anything else from rdoc.
|
170
|
+
#
|
171
|
+
# There is an attempt to handle @example tag differently, we surround it with a code block.
|
172
|
+
#
|
173
|
+
# @see https://rubydoc.info/gems/yard/file/docs/TagsArch.md
|
174
|
+
#
|
175
|
+
# @param object [YARD::CodeObjects::Base]
|
176
|
+
# @return [String] markdown formatted string of Tags
|
177
|
+
|
178
|
+
def render_tags(object)
|
179
|
+
result = String.new("")
|
180
|
+
object.tags.each do |tag|
|
181
|
+
result << if !(tag.tag_name == "example")
|
182
|
+
"**@#{tag.tag_name}** [#{tag.types&.join(', ')}] #{tag.text}\n"
|
183
|
+
else
|
184
|
+
""
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
object.tags.each do |tag|
|
189
|
+
result << if (tag.tag_name == "example")
|
190
|
+
"\n**@#{tag.tag_name}**\n```ruby\n#{tag.text}\n```"
|
191
|
+
else
|
192
|
+
""
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
result
|
197
|
+
end
|
198
|
+
|
154
199
|
def aref(object)
|
155
200
|
if object.type == :constant
|
156
201
|
"constant-#{object.name(false)}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav (Stas) Katkov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -51,11 +51,12 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
-
- example.
|
55
|
-
- example/
|
56
|
-
- example/
|
57
|
-
- example/Waterfowl.md
|
54
|
+
- example/Aquatic.md
|
55
|
+
- example/Fish.md
|
56
|
+
- example/Salmon.md
|
58
57
|
- example/index.csv
|
58
|
+
- example_rdoc.rb
|
59
|
+
- example_yard.rb
|
59
60
|
- lib/yard-markdown.rb
|
60
61
|
- sig/yard/markdown.rbs
|
61
62
|
- templates/default/fulldoc/markdown/setup.rb
|
data/example/Bird.md
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# Class: Bird
|
2
|
-
**Inherits:** Object
|
3
|
-
|
4
|
-
**Defined in:** example.rb
|
5
|
-
|
6
|
-
The base class for all birds.
|
7
|
-
|
8
|
-
# Public Instance Methods
|
9
|
-
## _fly_impl(_direction, _velocity) [](#method-i-_fly_impl)
|
10
|
-
:nodoc:
|
11
|
-
|
12
|
-
## fly(direction, velocity) [](#method-i-fly)
|
13
|
-
Fly somewhere.
|
14
|
-
|
15
|
-
Flying is the most critical feature of birds.
|
16
|
-
|
17
|
-
:args: direction, velocity
|
18
|
-
|
19
|
-
:call-seq:
|
20
|
-
Bird.fly(symbol, number) -> bool
|
21
|
-
Bird.fly(string, number) -> bool
|
22
|
-
|
23
|
-
# Example
|
24
|
-
|
25
|
-
fly(:south, 70)
|
26
|
-
|
27
|
-
## speak() [](#method-i-speak)
|
28
|
-
Produce some noise. -- FIXME: maybe extract this to a base class `Animal`? ++
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# Constants
|
33
|
-
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
34
|
-
Default velocity for a flying duck.
|
35
|
-
|
36
|
-
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
37
|
-
Maximum speed for a swimming duck.
|
38
|
-
|
data/example/Duck.md
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# Class: Duck
|
2
|
-
**Inherits:** Object
|
3
|
-
|
4
|
-
**Extended by:** Animal
|
5
|
-
|
6
|
-
**Includes:** Waterfowl
|
7
|
-
|
8
|
-
**Defined in:** example.rb
|
9
|
-
|
10
|
-
A duck is a Waterfowl Bird.
|
11
|
-
|
12
|
-
Features:
|
13
|
-
|
14
|
-
bird::
|
15
|
-
|
16
|
-
* speak
|
17
|
-
* fly
|
18
|
-
|
19
|
-
waterfowl::
|
20
|
-
|
21
|
-
* swim
|
22
|
-
|
23
|
-
# Public Instance Methods
|
24
|
-
## initialize(domestic, rubber) [](#method-i-initialize)
|
25
|
-
Creates a new duck.
|
26
|
-
|
27
|
-
## speak() [](#method-i-speak)
|
28
|
-
Duck overrides generic implementation.
|
29
|
-
|
30
|
-
## swim() [](#method-i-swim)
|
31
|
-
Swimming helper.
|
32
|
-
|
33
|
-
## useful?() [](#method-i-useful?)
|
34
|
-
Checks if this duck is a useful one.
|
35
|
-
|
36
|
-
:call-seq:
|
37
|
-
Bird.useful? -> bool
|
38
|
-
|
39
|
-
|
40
|
-
# Public Class Methods
|
41
|
-
## rubber_ducks() [](#method-c-rubber_ducks)
|
42
|
-
|
43
|
-
# Attributes
|
44
|
-
## domestic[RW] [](#attribute-i-domestic)
|
45
|
-
True for domestic ducks.
|
46
|
-
|
47
|
-
## rubber[RW] [](#attribute-i-rubber)
|
48
|
-
True for rubber ducks.
|
49
|
-
|
50
|
-
|
51
|
-
# Constants
|
52
|
-
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
53
|
-
Default velocity for a flying duck.
|
54
|
-
|
55
|
-
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
56
|
-
Maximum speed for a swimming duck.
|
57
|
-
|
data/example/Waterfowl.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# Module: Waterfowl
|
2
|
-
|
3
|
-
**Defined in:** example.rb
|
4
|
-
|
5
|
-
A mixin for waterfowl creatures.
|
6
|
-
|
7
|
-
# Public Instance Methods
|
8
|
-
## swim() [](#method-i-swim)
|
9
|
-
Swimming helper.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# Constants
|
14
|
-
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
15
|
-
Default velocity for a flying duck.
|
16
|
-
|
17
|
-
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
18
|
-
Maximum speed for a swimming duck.
|
19
|
-
|
File without changes
|