module Librarian::Helpers

PRIVATE

Adapters must not rely on these methods since they will change.

Adapters requiring similar methods ought to re-implement them.

Public Instance Methods

camel_cased_to_dasherized(camel_cased_word) click to toggle source
active_support/inflector/methods
# File lib/librarian/helpers.rb, line 19
def camel_cased_to_dasherized(camel_cased_word)
  word = camel_cased_word.to_s.dup
  word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1-\2')
  word.gsub!(/([a-z\d])([A-Z])/,'\1-\2')
  word.downcase!
  word
end
strip_heredoc(string) click to toggle source
active_support/core_ext/string/strip
# File lib/librarian/helpers.rb, line 12
def strip_heredoc(string)
  indent = string.scan(/^[ \t]*(?=\S)/).min
  indent = indent.respond_to?(:size) ? indent.size : 0
  string.gsub(/^[ \t]{#{indent}}/, '')
end