Sha256: 48dfca3227a080550a284d94cbb9e10e90863bc451f4c8b5770df6d3a57d1f91

Contents?: true

Size: 710 Bytes

Versions: 5

Compression:

Stored size: 710 Bytes

Contents

module Rack::App::FrontEnd::Utils

  extend self

  def get_full_path(file_path,caller_index=1)
    return nil if file_path.nil?
    if file_path.to_s[0] == '/'
      Rack::App::Utils.pwd(file_path)
    else
      File.expand_path(File.join(File.dirname(caller[caller_index].split(':')[0]),file_path))
    end
  end

  # Based on ActiveSupport, removed inflections.
  # https://github.com/rails/rails/blob/v4.1.0.rc1/activesupport/lib/active_support/inflector/methods.rb
  def underscore(camel_cased_word)
    word = camel_cased_word.to_s.gsub('::', '/')
    word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
    word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
    word.tr!("-", "_")
    word.downcase!
    word
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-app-front_end-0.10.0 lib/rack/app/front_end/utils.rb
rack-app-front_end-0.8.0 lib/rack/app/front_end/utils.rb
rack-app-front_end-0.7.0 lib/rack/app/front_end/utils.rb
rack-app-front_end-0.6.0 lib/rack/app/front_end/utils.rb
rack-app-front_end-0.5.0 lib/rack/app/front_end/utils.rb