Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from wagenet/master

Doc extraction fixes
  • Loading branch information...
commit 2c0a9a6220f09a9341d48ee4653b7abf0c517865 2 parents 9bb0462 + 2044005
@wycats authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.