Module: ApiHelper

Included in:
Shopping::Publisher
Defined in:
lib/api_helpers/api_helper.rb

Instance Method Summary collapse

Instance Method Details

#to_d_or_nil(string_value) ⇒ Object



6
7
8
# File 'lib/api_helpers/api_helper.rb', line 6

def to_d_or_nil(string_value)
  string_value.nil? ? nil : BigDecimal(string_value.strip) rescue nil
end

#to_i_or_nil(string_value) ⇒ Object



2
3
4
# File 'lib/api_helpers/api_helper.rb', line 2

def to_i_or_nil(string_value)
  string_value.nil? ? nil : string_value.strip.to_i rescue nil
end