lib/yard/code_objects/method_object.rb in yard-0.2.2 vs lib/yard/code_objects/method_object.rb in yard-0.2.3

- old
+ new

@@ -1,17 +1,24 @@ module YARD::CodeObjects class MethodObject < Base - attr_accessor :visibility, :scope, :explicit + attr_accessor :visibility, :scope, :explicit, :parameters def initialize(namespace, name, scope = :instance) self.visibility = :public self.scope = scope + self.parameters = [] super end - def scope=(v) @scope = v.to_sym end + def scope=(v) + reregister = @scope ? true : false + YARD::Registry.delete(self) if reregister + @scope = v.to_sym + YARD::Registry.register(self) if reregister + end + def visibility=(v) @visibility = v.to_sym end def is_attribute? namespace.attributes[scope].has_key? name.to_s.gsub(/=$/, '') end @@ -39,13 +46,19 @@ super end end def name(prefix = false) - prefix && sep == ISEP ? sep + super().to_s : super() + ((prefix ? (sep == ISEP ? sep : "") : "") + super().to_s).to_sym end protected - def sep; scope == :class ? super : ISEP end + def sep + if scope == :class + namespace && namespace != YARD::Registry.root ? CSEP : NSEP + else + ISEP + end + end end -end \ No newline at end of file +end