Module: Mapel
- Defined in:
- lib/mapel.rb
Defined Under Namespace
Class Method Summary collapse
-
.camelize(word, *args) ⇒ Object
By default, camelize converts strings to UpperCamelCase.
-
.info(source, engine = :image_magick) ⇒ Object
Mapel.info(‘image.jpg’).
-
.list(engine = :image_magick) ⇒ Object
Mapel.list.
-
.render(source, engine = :image_magick) ⇒ Object
Mapel.render(‘image.jpg’).resize(“50%”).to(‘output.jpg’).run.
Class Method Details
.camelize(word, *args) ⇒ Object
By default, camelize converts strings to UpperCamelCase.
camelize will also convert ‘/’ to ‘::’ which is useful for converting paths to namespaces
“active_record”.camelize #=> “ActiveRecord” “active_record/errors”.camelize #=> “ActiveRecord::Errors”
166 167 168 |
# File 'lib/mapel.rb', line 166 def self.camelize(word, *args) word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } end |
.info(source, engine = :image_magick) ⇒ Object
Mapel.info(‘image.jpg’)
8 9 10 |
# File 'lib/mapel.rb', line 8 def self.info(source, engine = :image_magick) Mapel::Engine.const_get(camelize(engine)).info(source) end |