Sha256: 745f187d6f0cce1de648274921b41d0ad6c67796d1b8ec5dda8df01b8d3f2081

Contents?: true

Size: 417 Bytes

Versions: 5

Compression:

Stored size: 417 Bytes

Contents

module StatusTag
  module Utils

    MOD_SEPARATOR = "::"

    def class_from_string(str)
      str.split(MOD_SEPARATOR).inject(Object) do |mod, class_name|
        mod.const_get(class_name)
      end
    rescue
      nil
    end

    def namespaces_from_class(klass)
      klass.to_s.split(MOD_SEPARATOR)
    end

    def camelize_underscored(str)
      str.split('_').map {|w| w.capitalize}.join
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
status_tag-0.2.0 lib/status_tag/utils.rb
status_tag-0.1.3 lib/status_tag/utils.rb
status_tag-0.1.2 lib/status_tag/utils.rb
status_tag-0.1.1 lib/status_tag/utils.rb
status_tag-0.1.0 lib/status_tag/utils.rb