Module: FFmpeg::FilterGraph::Utils::Strings

Included in:
Filter, FilterFactory
Defined in:
lib/ffmpeg/filter_graph/utils/strings.rb

Instance Method Summary collapse

Instance Method Details

#underscore(camel_cased_word) ⇒ Object

From github: activesupport/lib/active_support/inflector/methods.rb



5
6
7
8
9
10
11
12
13
# File 'lib/ffmpeg/filter_graph/utils/strings.rb', line 5

def underscore(camel_cased_word)
  return camel_cased_word unless camel_cased_word =~ /[A-Z-]/
  word = camel_cased_word.dup
  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