Module: JSound::TypeFromClassName::ClassMethods

Defined in:
lib/jsound/type_from_class_name.rb

Overview

Class-level methods added when including TypeFromClassName

Instance Method Summary collapse

Instance Method Details

#typeObject

Extract the class name (from fully qualified Module::Class string) and convert camel case to snake case.

Examples:

JSound::Midi::Messages::NoteOn => :note_on



17
18
19
# File 'lib/jsound/type_from_class_name.rb', line 17

def type             
  name.split('::').last.gsub(/(.)([A-Z])/,'\1_\2').downcase.to_sym
end