Module: Class2::SnakeCase::Attributes

Defined in:
lib/class2.rb

Overview

Support snake_case attributes. This will accept them in the constructor and return them via #to_h.

The key format used to define the class will still be accepted and its accessors will remain.

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



316
317
318
# File 'lib/class2.rb', line 316

def self.included(klass)
  Util.convert_attributes(klass) { |v| v.underscore }
end