lazydoc 0.3.0 → 0.3.1

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/History ADDED
@@ -0,0 +1,6 @@
1
+ == 0.3.1 / 2009-02-17
2
+
3
+ Update release with trivial changes that remove warnings under ruby 1.9
4
+ and to accommodate JRuby 1.1.6
5
+
6
+ * documents may now set default_const_name
data/lib/lazydoc.rb CHANGED
@@ -24,14 +24,11 @@ module Lazydoc
24
24
  lazydoc = registry.find {|doc| doc.source_file == source_file }
25
25
 
26
26
  unless lazydoc
27
- lazydoc = Document.new(source_file, default_const_name)
27
+ lazydoc = Document.new(source_file)
28
28
  registry << lazydoc
29
29
  end
30
30
 
31
- if lazydoc.default_const_name != default_const_name
32
- raise ArgumentError, "inconsistent default_const_name specified for #{source_file}: #{lazydoc.default_const_name.inspect} != #{default_const_name.inspect}"
33
- end
34
-
31
+ lazydoc.default_const_name = default_const_name
35
32
  lazydoc
36
33
  end
37
34
 
@@ -221,14 +221,14 @@ module Lazydoc
221
221
  # As shown in the examples, the dynamically determined line_number
222
222
  # overwrites the Regexp or Proc.
223
223
  def parse_up(str, lines=nil, skip_subject=true)
224
- parse(str, lines) do |n, lines|
224
+ parse(str, lines) do |n, comment_lines|
225
225
  # remove whitespace lines
226
226
  n -= 1 if skip_subject
227
- n -= 1 while n >=0 && lines[n].strip.empty?
227
+ n -= 1 while n >=0 && comment_lines[n].strip.empty?
228
228
 
229
229
  # put together the comment
230
230
  while n >= 0
231
- line = lines[n]
231
+ line = comment_lines[n]
232
232
  break if block_given? && yield(line)
233
233
  break unless prepend(line)
234
234
  n -= 1
@@ -260,12 +260,12 @@ module Lazydoc
260
260
  # c.comment # => "documentation for section two"
261
261
  #
262
262
  def parse_down(str, lines=nil, skip_subject=true)
263
- parse(str, lines) do |n, lines|
263
+ parse(str, lines) do |n, comment_lines|
264
264
  # skip the subject line
265
265
  n += 1 if skip_subject
266
266
 
267
267
  # put together the comment
268
- while line = lines[n]
268
+ while line = comment_lines[n]
269
269
  break if block_given? && yield(line)
270
270
  break unless append(line)
271
271
  n += 1
@@ -146,6 +146,15 @@ module Lazydoc
146
146
  @source_file = source_file == nil ? nil : File.expand_path(source_file)
147
147
  end
148
148
 
149
+ # Sets the default_const_name. Raises an error if default_const_name is
150
+ # already set to a different value.
151
+ def default_const_name=(input)
152
+ @default_const_name = case @default_const_name
153
+ when nil, input then input
154
+ else raise ArgumentError, "default_const_name cannot be overridden #{source_file}: #{@default_const_name.inspect} != #{input.inspect}"
155
+ end
156
+ end
157
+
149
158
  # Registers the specified line number to self. Register may take an
150
159
  # integer or a regexp for dynamic evaluation. See Comment#resolve for
151
160
  # more details.
data/lib/lazydoc/utils.rb CHANGED
@@ -85,7 +85,8 @@ module Lazydoc
85
85
  args = []
86
86
  brakets = braces = parens = 0
87
87
  start = scanner.pos
88
- broke = while scanner.skip(/.*?['"#,\(\)\{\}\[\]]/)
88
+ broke = false
89
+ while scanner.skip(/.*?['"#,\(\)\{\}\[\]]/)
89
90
  pos = scanner.pos - 1
90
91
 
91
92
  case str[pos]
@@ -97,13 +98,15 @@ module Lazydoc
97
98
  args << str[start, pos-start].strip
98
99
  start = pos + 1
99
100
 
100
- when ?# then break(true) # break on a comment
101
+ when ?# then broke = true; break # break on a comment
101
102
  when ?' then skip_quote(scanner, /'/) # parse over quoted strings
102
103
  when ?" then skip_quote(scanner, /"/) # parse over double-quoted string
103
104
 
104
105
  when ?( then parens += 1 # for brakets, braces, and parenthesis
105
106
  when ?) # simply track the nesting EXCEPT for
106
- break(true) if parens == 0 # RPAREN. If the closing parenthesis
107
+ if parens == 0 # RPAREN. If the closing parenthesis
108
+ broke = true; break
109
+ end
107
110
  parens -= 1 # is found, break.
108
111
  when ?[ then braces += 1
109
112
  when ?] then braces -= 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazydoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Chiang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-31 00:00:00 -07:00
12
+ date: 2009-02-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,6 +22,7 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README
24
24
  - MIT-LICENSE
25
+ - History
25
26
  files:
26
27
  - lib/lazydoc.rb
27
28
  - lib/lazydoc/arguments.rb
@@ -34,6 +35,7 @@ files:
34
35
  - lib/lazydoc/utils.rb
35
36
  - README
36
37
  - MIT-LICENSE
38
+ - History
37
39
  has_rdoc: true
38
40
  homepage: http://tap.rubyforge.org/lazydoc
39
41
  post_install_message: