Module: MonkeyCamels

Defined in:
lib/attribute_struct/monkey_camels.rb

Defined Under Namespace

Modules: Humps

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/attribute_struct/monkey_camels.rb', line 4

def included(klass)
  klass.class_eval do

    include Humps

    alias_method :un_camel_to_s, :to_s
    alias_method :to_s, :camel_to_s
    alias_method :un_camel_initialize_copy, :initialize_copy
    alias_method :initialize_copy, :camel_initialize_copy
  end
end

Instance Method Details

#camel_initialize_copy(orig) ⇒ String

Create a camel copy based on settings

Returns:

  • (String)


20
21
22
23
# File 'lib/attribute_struct/monkey_camels.rb', line 20

def camel_initialize_copy(orig)
  new_val = un_camel_initialize_copy(orig)
  orig._camel? ? new_val : new_val._no_hump
end

#camel_to_sString

Provide string formatted based on hump setting

Returns:

  • (String)


28
29
30
31
# File 'lib/attribute_struct/monkey_camels.rb', line 28

def camel_to_s
  val = un_camel_to_s
  _camel? ? val : val._no_hump
end