tomdoc 0.2.1 → 0.2.2
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.
- data/lib/tomdoc/arg.rb +8 -0
- data/lib/tomdoc/tomdoc.rb +23 -5
- data/lib/tomdoc/version.rb +1 -1
- metadata +3 -3
data/lib/tomdoc/arg.rb
CHANGED
@@ -2,11 +2,19 @@ module TomDoc
|
|
2
2
|
class Arg
|
3
3
|
attr_accessor :name, :description
|
4
4
|
|
5
|
+
# Create new Arg object.
|
6
|
+
#
|
7
|
+
# name - name of argument
|
8
|
+
# description - arguments description
|
9
|
+
#
|
5
10
|
def initialize(name, description = '')
|
6
11
|
@name = name.to_s.intern
|
7
12
|
@description = description
|
8
13
|
end
|
9
14
|
|
15
|
+
# Is this an optional argument?
|
16
|
+
#
|
17
|
+
# Returns Boolean.
|
10
18
|
def optional?
|
11
19
|
@description.downcase.include? 'optional'
|
12
20
|
end
|
data/lib/tomdoc/tomdoc.rb
CHANGED
@@ -1,13 +1,31 @@
|
|
1
1
|
module TomDoc
|
2
|
+
|
3
|
+
# TomDoc class needs Arg class.
|
4
|
+
if RUBY_VERSION > '1.9'
|
5
|
+
require_relative 'arg'
|
6
|
+
else
|
7
|
+
require 'tomdoc/arg'
|
8
|
+
end
|
9
|
+
|
2
10
|
class InvalidTomDoc < RuntimeError
|
11
|
+
# Create new InvalidTomDoc object.
|
12
|
+
#
|
13
|
+
# doc - document string
|
14
|
+
#
|
3
15
|
def initialize(doc)
|
4
16
|
@doc = doc
|
5
17
|
end
|
6
18
|
|
19
|
+
# Provide access to document string.
|
20
|
+
#
|
21
|
+
# Returns String.
|
7
22
|
def message
|
8
23
|
@doc
|
9
24
|
end
|
10
25
|
|
26
|
+
# Provide access to document string.
|
27
|
+
#
|
28
|
+
# Returns String.
|
11
29
|
def to_s
|
12
30
|
@doc
|
13
31
|
end
|
@@ -47,11 +65,11 @@ module TomDoc
|
|
47
65
|
end
|
48
66
|
|
49
67
|
def tomdoc
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
clean
|
68
|
+
raw
|
69
|
+
#clean = raw.split("\n").map do |line|
|
70
|
+
# line =~ /^(\s*# ?)/ ? line.sub($1, '') : nil
|
71
|
+
#end.compact.join("\n")
|
72
|
+
#clean
|
55
73
|
end
|
56
74
|
|
57
75
|
def sections
|
data/lib/tomdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Preston-Werner
|