module Nicos::Converter

Public Class Methods

commaRemover(str) click to toggle source
# File lib/classes/converter.rb, line 30
def commaRemover(str)
  str.gsub(/\,/, '').to_i
end
iso8601ToUnix(str) click to toggle source
# File lib/classes/converter.rb, line 9
def iso8601ToUnix(str)
  Time.strptime(str, "%Y-%m-%dT%H:%M:%S").to_i
end
japToUnix(str) click to toggle source
# File lib/classes/converter.rb, line 14
def japToUnix(str)
  str.gsub!(/年|月/, '-')
    .gsub!(/日/, 'T')
    .gsub!(/:/, ':')
    .gsub!(/\s/, '')
  iso8601ToUnix(str)
end
toSeconds(lengthStr) click to toggle source
# File lib/classes/converter.rb, line 23
def toSeconds(lengthStr)
  # lengthStr = "mm:ss"
  lengthStr = lengthStr.split(/\:/)
  lengthStr[0].to_i * 60 + lengthStr[1].to_i
end

Private Instance Methods

commaRemover(str) click to toggle source
# File lib/classes/converter.rb, line 30
def commaRemover(str)
  str.gsub(/\,/, '').to_i
end
iso8601ToUnix(str) click to toggle source
# File lib/classes/converter.rb, line 9
def iso8601ToUnix(str)
  Time.strptime(str, "%Y-%m-%dT%H:%M:%S").to_i
end
japToUnix(str) click to toggle source
# File lib/classes/converter.rb, line 14
def japToUnix(str)
  str.gsub!(/年|月/, '-')
    .gsub!(/日/, 'T')
    .gsub!(/:/, ':')
    .gsub!(/\s/, '')
  iso8601ToUnix(str)
end
toSeconds(lengthStr) click to toggle source
# File lib/classes/converter.rb, line 23
def toSeconds(lengthStr)
  # lengthStr = "mm:ss"
  lengthStr = lengthStr.split(/\:/)
  lengthStr[0].to_i * 60 + lengthStr[1].to_i
end