Ruby - Naming Convention - letter case for acronyms in class/module names?

前端 未结 3 2079
失恋的感觉
失恋的感觉 2021-01-04 01:20

I need to create a class that represent \"SVN\" inside a module called \"SCM\". But I don\'t know what is the convention when dealing with acronyms in Ruby, and could not fi

3条回答
  •  天命终不由人
    2021-01-04 01:49

    Add the following to config/initializers/inflections.rb.

    ActiveSupport::Inflector.inflections(:en) do |inflect|
      inflect.acronym 'SVN'
    end
    

    Now running $ rails g model SVN… will create a class named SVN in a file named svn.rb and an associated table svns.

提交回复
热议问题