Module: Gemma::Conventions
- Defined in:
- lib/gemma/conventions.rb
Overview
Methods to check input against accepted conventions.
For help on extensions:
-
nokogiri.org/tutorials/installing_nokogiri.html explains how to
prepare several unices to build native extensions.
General objectives for gemma:
-
follow and promote accepted conventions where obvious
-
make the outputs from rdoc, test, etc. work like they do in rubygems
-
avoid load path noise ($: << …)
-
make it easy to start hacking on an existing gem that uses gemma
-
git clone …
-
gem install bundle
-
bundle # install both gemma dependencies and the gem’s dependencies
-
rake -T # should now work
-
Class Method Summary collapse
-
.gem_name_to_module_name(gem_name) ⇒ String
Convert from underscore-lower-case form to camel-case form; hyphens are also converted to camel case.
-
.good_gem_name?(gem_name) ⇒ Boolean
Check gem naming conventions; this is sufficient but not necessary for the gem name to be valid.
Class Method Details
.gem_name_to_module_name(gem_name) ⇒ String
Convert from underscore-lower-case form to camel-case form; hyphens are also converted to camel case.
43 44 45 |
# File 'lib/gemma/conventions.rb', line 43 def self.gem_name_to_module_name(gem_name) gem_name.gsub(/(?:^|_|-)([a-z0-9])/) { Regexp.last_match(1).upcase } end |
.good_gem_name?(gem_name) ⇒ Boolean
Check gem naming conventions; this is sufficient but not necessary for the gem name to be valid.
References:
33 34 35 |
# File 'lib/gemma/conventions.rb', line 33 def self.good_gem_name?(gem_name) gem_name =~ /^[a-z0-9]+[a-z0-9_\-]*$/ end |