Class: Thimbl::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/thimbl/utils.rb

Class Method Summary collapse

Class Method Details

.parse_time(time) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/thimbl/utils.rb', line 10

def self.parse_time( time )
  if time.is_a? Numeric
    Time.at time
  else
    Time.utc( time[0,4], time[4,2], time[6,2], time[8,2], time[10,2], time[12,2] )
  end
end

.to_file(text) ⇒ Object



3
4
5
6
7
8
# File 'lib/thimbl/utils.rb', line 3

def self.to_file( text )
  file = Tempfile.new('plan.json')
  file.write( text )
  file.close
  file.path
end