Module: Nicos::Converter
- Defined in:
- lib/classes/converter.rb
Class Method Summary collapse
- .commaRemover(str) ⇒ Object
- .iso8601ToUnix(str) ⇒ Object
- .japToUnix(str) ⇒ Object
- .toSeconds(lengthStr) ⇒ Object
Class Method Details
.commaRemover(str) ⇒ Object
31 32 33 |
# File 'lib/classes/converter.rb', line 31 def commaRemover(str) str.gsub(/\,/, '').to_i end |
.iso8601ToUnix(str) ⇒ Object
10 11 12 |
# File 'lib/classes/converter.rb', line 10 def iso8601ToUnix(str) Time.strptime(str, "%Y-%m-%dT%H:%M:%S").to_i end |
.japToUnix(str) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/classes/converter.rb', line 15 def japToUnix(str) str.gsub!(/年|月/, '-') .gsub!(/日/, 'T') .gsub!(/:/, ':') .gsub!(/\s/, '') iso8601ToUnix(str) end |
.toSeconds(lengthStr) ⇒ Object
24 25 26 27 28 |
# File 'lib/classes/converter.rb', line 24 def toSeconds(lengthStr) # lengthStr = "mm:ss" lengthStr = lengthStr.split(/\:/) lengthStr[0].to_i * 60 + lengthStr[1].to_i end |