Sha256: 6ac5279b229c6f2b4d0e491fcec1a1417298f0c395523f3ed52b0c68eceb49c5
Contents?: true
Size: 495 Bytes
Versions: 13
Compression:
Stored size: 495 Bytes
Contents
module CMS::Template extend self class InvalidOptionKey < Exception ; end def inject_options options "".tap { |s| options.each { |k,v| s << ", #{_validate_option_key(k)}: #{v.inspect}" } } end def add_comma content if content.strip.present? ", #{content}" else content end end private def _validate_option_key key unless key =~ /^[a-z0-9_]+$/ raise CMS::Template::InvalidOptionKey, "Key #{key} is not valid." end key end end
Version data entries
13 entries across 13 versions & 1 rubygems