Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/biosphere/kube.rb

Instance Method Summary collapse

Instance Method Details

#underscore_caseObject

Converts “CamelCase”“ into ”camel_case“



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/biosphere/kube.rb', line 11

def underscore_case()
    str = ""
    self.chars.each do |c|
        if c == c.upcase
            if str != ""
                str += "_"
            end
            str += c.downcase
        else
            str += c
        end
    end

    return str
end