Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/hoopla_salesforce/ext/string.rb

Direct Known Subclasses

HooplaSalesforce::OutputBuffer

Instance Method Summary collapse

Instance Method Details

#camelize(first_letter_in_uppercase = true) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/hoopla_salesforce/ext/string.rb', line 7

def camelize(first_letter_in_uppercase = true)
  if first_letter_in_uppercase
    gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
  else
    first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
  end
end

#marginObject



2
3
4
5
# File 'lib/hoopla_salesforce/ext/string.rb', line 2

def margin
  spaces = match(/^\s*/)
  gsub(/^#{spaces[0]}/, '')
end