Code Monkey home page Code Monkey logo

Comments (2)

drbrain avatar drbrain commented on May 29, 2024

I don't see the need to have different generator names from the class name. Generator names should be short and simple so they're easy for the user to type after -f, and so should the class name.

The example in the documentation does not produce "generator":

irb> My::Awesome::Generator.name.sub(/^RDoc::Generator::/, '').downcase
=> "my::awesome::generator"

from rdoc.

trans avatar trans commented on May 29, 2024

My mistake, my::awesome::generator is what I meant to put.

I have written a few generators, and as I do with any project, I was writing the code thusly:

# lib/coolname/generator.rb
module CoolName
  class Generator
    ...
  end
end

So that my project has proper namespace. But I obviously don't want the format to be coolname::generator, I just want it to be coolname. That is why one might want the format name to differ from the class name.

In any case it's not that big a deal since one can just hack around it by redefining the name class method. On the hand, b/c of this issue I'm now inclined to just name the classes RDoc::Generator::CoolName -- I'm not sure how that fairs for best practices, but it seems to be what RDoc wants me to do given the definition of #add_generator.

from rdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.