Module: FFmpeg::FilterGraph::Utils::Strings
- Included in:
- FilterFactory
- Defined in:
- lib/ffmpeg/filter_graph/utils/strings.rb
Instance Method Summary collapse
-
#underscore(camel_cased_word) ⇒ Object
From github: activesupport/lib/active_support/inflector/methods.rb.
Instance Method Details
#underscore(camel_cased_word) ⇒ Object
From github: activesupport/lib/active_support/inflector/methods.rb
4 5 6 7 8 9 10 11 12 |
# File 'lib/ffmpeg/filter_graph/utils/strings.rb', line 4 def underscore(camel_cased_word) return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/ 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 |