Sha256: 57c46be34c3f3a8711835fd80b43f7e334878a13fea6d0855480b0516380db0a
Contents?: true
Size: 560 Bytes
Versions: 6
Compression:
Stored size: 560 Bytes
Contents
# frozen_string_literal: true module WCC::Blogs module Utils def camelcase(term) term .to_s .gsub(%r{(?:_|(/))([a-z\d]*)}) { "#{Regexp.last_match(1)}#{Regexp.last_match(2).capitalize}" } .gsub(%r{/}, '::') end def define_camelcase_alias(*underscore_method_names, &block) underscore_method_names.each do |method| attribute = camelcase(method) define_method(method) { instance_exec(attribute, &block) } alias_method attribute, method if attribute != method end end end end
Version data entries
6 entries across 6 versions & 1 rubygems