lib/kramdown/utils.rb in kramdown-0.13.4 vs lib/kramdown/utils.rb in kramdown-0.13.5

- old
+ new

@@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # #-- -# Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at> +# Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at> # # This file is part of kramdown. # # kramdown is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,9 +29,14 @@ module Utils autoload :Entities, 'kramdown/utils/entities' autoload :Html, 'kramdown/utils/html' autoload :OrderedHash, 'kramdown/utils/ordered_hash' + + # Treat +name+ as if it were snake cased (e.g. snake_case) and camelize it (e.g. SnakeCase). + def self.camelize(name) + name.split('_').inject('') {|s,x| s << x[0..0].upcase + x[1..-1] } + end end end