Class: Sequel::Funky::FunkyBase

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/extensions/funky.rb

Direct Known Subclasses

FunkyDuckDB, FunkySpark

Instance Method Summary collapse

Constructor Details

#initialize(db) ⇒ FunkyBase

Returns a new instance of FunkyBase.



7
8
9
# File 'lib/sequel/extensions/funky.rb', line 7

def initialize(db)
  @db = db
end

Instance Method Details

#from_strptime(format) ⇒ Object



17
18
19
20
21
# File 'lib/sequel/extensions/funky.rb', line 17

def from_strptime(format)
  return format unless format =~ /%/

  format.gsub('%Y', 'yyyy').gsub('%m', 'MM').gsub('%d', 'dd')
end

#to_strptime(format) ⇒ Object



11
12
13
14
15
# File 'lib/sequel/extensions/funky.rb', line 11

def to_strptime(format)
  return format if format =~ /%/

  format.gsub('yyyy', '%Y').gsub('MM', '%m').gsub('dd', '%d')
end