Sha256: f2899588b2c3f2db58bd4d9eb71f7a00fbc175206892dba28ccc3c91a852ac11

Contents?: true

Size: 551 Bytes

Versions: 16

Compression:

Stored size: 551 Bytes

Contents

require 'active_support/inflector'

module TMS::CoreExt
  def demodulize(path)
    ActiveSupport::Inflector.demodulize(path)
  end

  def classify(str)
    ActiveSupport::Inflector.camelize(str)
  end

  def singularize(str)
      ActiveSupport::Inflector.singularize(str)
    end

  def pluralize(str)
    ActiveSupport::Inflector.pluralize(str)
  end

  def tmsify(klassname)
    ActiveSupport::Inflector.underscore(demodulize(klassname))
  end

  def instance_class(klass)
    ActiveSupport::Inflector.constantize(singularize(klass.to_s))
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
govdelivery-tms-0.8.0 lib/govdelivery-tms/util/core_ext.rb
tms_client-0.6.0 lib/tms_client/util/core_ext.rb
tms_client-0.5.4 lib/tms_client/util/core_ext.rb
tms_client-0.5.3 lib/tms_client/util/core_ext.rb
tms_client-0.5.2 lib/tms_client/util/core_ext.rb
tms_client-0.5.1 lib/tms_client/util/core_ext.rb
tms_client-0.4.1 lib/tms_client/util/core_ext.rb
tms_client-0.4.0 lib/tms_client/util/core_ext.rb
tms_client-0.3.0 lib/tms_client/util/core_ext.rb
tms_client-0.2.2 lib/tms_client/util/core_ext.rb
tms_client-0.2.1 lib/tms_client/util/core_ext.rb
tms_client-0.2.0 lib/tms_client/util/core_ext.rb
tms_client-0.1.1 lib/tms_client/util/core_ext.rb
tms_client-0.1.0 lib/tms_client/util/core_ext.rb
tms_client-0.0.3 lib/tms_client/util/core_ext.rb
tms_client-0.0.2 lib/tms_client/util/core_ext.rb