Module: MuchFactory::TypeConverter

Defined in:
lib/much-factory.rb

Class Method Summary collapse

Class Method Details

.binary(input) ⇒ Object



125
126
127
# File 'lib/much-factory.rb', line 125

def self.binary(input)
  input
end

.boolean(input) ⇒ Object



121
122
123
# File 'lib/much-factory.rb', line 121

def self.boolean(input)
  !!input
end

.date(input) ⇒ Object



117
118
119
# File 'lib/much-factory.rb', line 117

def self.date(input)
  Date.parse(input.to_s)
end

.datetime(input) ⇒ Object



109
110
111
# File 'lib/much-factory.rb', line 109

def self.datetime(input)
  DateTime.parse(input.to_s) # rubocop:disable Style/DateTime
end

.float(input) ⇒ Object



105
106
107
# File 'lib/much-factory.rb', line 105

def self.float(input)
  input.to_f
end

.integer(input) ⇒ Object



101
102
103
# File 'lib/much-factory.rb', line 101

def self.integer(input)
  input.to_i
end

.string(input) ⇒ Object



97
98
99
# File 'lib/much-factory.rb', line 97

def self.string(input)
  input.to_s
end

.time(input) ⇒ Object



113
114
115
# File 'lib/much-factory.rb', line 113

def self.time(input)
  Time.parse(input.to_s)
end