Module: Librarian::Helpers
Overview
PRIVATE
Adapters must not rely on these methods since they will change.
Adapters requiring similar methods ought to re-implement them.
Instance Method Summary collapse
-
#camel_cased_to_dasherized(camel_cased_word) ⇒ Object
[active_support/inflector/methods].
-
#strip_heredoc(string) ⇒ Object
[active_support/core_ext/string/strip].
Instance Method Details
#camel_cased_to_dasherized(camel_cased_word) ⇒ Object
- active_support/inflector/methods
19 20 21 22 23 24 25 |
# 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) ⇒ Object
- active_support/core_ext/string/strip
12 13 14 15 16 |
# 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 |