Class namespacing

Issue #5 resolved
Amrut Jadhav created an issue

When class name is

class   Something::This::Like

, plugin generate yard documentation such as

# class Something provides  <description>
#
class   Something::This::Like

It should generate like this

# class Something::This::Like provides  <description>
#
class   Something::This::Like

Total name of name spaced class should be appear not only first class name.

Try to update your module regex like this

 r = re.search("(?P<indent>^\s*)(?P<mod_or_class>module|class?[:a-zA-Z0-9]*)\s+(?P<name>[:A-Z][:a-zA-Z0-9]*).*?$",line_for_selection)

Comments (6)

  1. Fred Appelman repo owner

    I have made a fix but didn't go with your regular expression. The reason is that the part right after the word class ?[:a-zA-Z0-9]* seems out of place. It makes that e.g.

    classroom  Something::This::Like
      #
    end
    

    would also be recognised. Additionally it would also recognise constructions like:

    class  Something:This:Like
      #
    end
    

    would be recognised which I prefer not to. I ended up with:

    r = re.search("(?P<indent>^\s*)(?P<mod_or_class>module|class)\s+(?P<name>[A-Z][a-zA-Z0-9]*(::[A-Z][a-zA-Z0-9]*)*).*?$",line_for_selection)
    
  2. Amrut Jadhav reporter

    It's actually better than mine. Good. Hey, why you do not provide other doc helpers also like for associations, mongoid fields, validations etc. Some example like

    # Associtions
    has_many :members
    
    # Fields
    field :name, type: "String"
    
    # Validations
    validate_presence_of :name 
    

    They are minor ones. But they actually helps a lot. It will motivate those developers who don't want to write documentations. These small tweaks will inspire them to write more expressible code. I had downloaded your repo and customized according my needs. It actually have above mentioned changes. It helps me. You should consider provide in your gem also.

  3. Log in to comment