Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Doc extraction fixes #1

Merged
merged 3 commits into from

2 participants

@wagenet
Collaborator

No description provided.

@wycats wycats merged commit 2c0a9a6 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 18, 2012
  1. Force strings to binary when parsing

    Peter Wagenet authored
  2. Fixed ParameterList map calls

    Peter Wagenet authored
  3. Better namespace handling

    Peter Wagenet authored
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 11 deletions.
  1. +1 −0  lib/parsejs.rb
  2. +4 −11 lib/parsejs/docs.rb
View
1  lib/parsejs.rb
@@ -6,6 +6,7 @@
module ParseJS
def self.parse(string)
+ string = string.force_encoding('BINARY') if string.respond_to?(:force_encoding)
parser = ParseJS::Parser.new(string)
parser.parse
parser.result
View
15 lib/parsejs/docs.rb
@@ -77,11 +77,11 @@ def visit_Program(program)
end
def visit_FunctionDeclaration(decl)
- with_variables(decl) { super }
+ with_variables(decl, decl.params.list.map(&:val)) { super }
end
def visit_FunctionExpression(expr)
- with_variables(expr) { super }
+ with_variables(expr, expr.params.list.map(&:val)) { super }
end
def with_variables(expr, params=expr.params.map(&:val))
@@ -160,15 +160,8 @@ def build_namespace(namespace)
elsif ns = YARD::Registry.at(namespace)
ns
else
- parts = namespace.split("::")
- parent = parts[0...-1].join("::")
-
- if parent.empty?
- YARD::CodeObjects::NamespaceObject.new(YARD::Registry.root, parts[-1])
- else
- build_namespace parent
- YARD::CodeObjects::NamespaceObject.new(parent, parts[-1])
- end
+ name = namespace.gsub('::', '.')
+ YARD::CodeObjects::NamespaceObject.new(:root, name)
end
end
Something went wrong with that request. Please try again.