Module: Shipwire::Utility

Defined in:
lib/shipwire/utility.rb

Class Method Summary collapse

Class Method Details

.camel_case(options) ⇒ Object



3
4
5
# File 'lib/shipwire/utility.rb', line 3

def self.camel_case(options)
  ParamConverter.new(options).to_h
end

.camelize(term, first_letter = :upper) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/shipwire/utility.rb', line 11

def self.camelize(term, first_letter = :upper)
  terms = term.split('_')

  case first_letter
  when :upper
    terms.map(&:capitalize!).join
  when :lower
    ([terms.first] + terms.drop(1).map(&:capitalize!)).join
  end
end

.split_to_integers(str, separator = ",") ⇒ Object



7
8
9
# File 'lib/shipwire/utility.rb', line 7

def self.split_to_integers(str, separator = ",")
  str.to_s.split(separator).map(&:to_i)
end