Module: PriceHelper

Defined in:
lib/helper/price_helper.rb

Instance Method Summary collapse

Instance Method Details

#deal_fee(str) ⇒ Object

example: 60 - 940元



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/helper/price_helper.rb', line 4

def deal_fee(str)
  fee = str.scan(/\d+/)

  if str.include?("免费")
    fee << "0"
  end
  if str.include?("FREE")
    fee << "0"
  end
  if str.include?("未知")
    fee << "未知"
  end
  fee = fee.uniq
  fee = fee.sort_by do |f|
    f.to_i
  end
  fee
end