Module: Ohm::Types

Defined in:
lib/ohm/contrib/typecast.rb

Overview

Provides all the primitive types. The following are included:

  • String

  • Decimal

  • Integer

  • Float

  • Date

  • Time

  • Hash

  • Array

  • Boolean

Defined Under Namespace

Classes: Array, Base, Boolean, Date, Decimal, Float, Hash, Integer, Primitive, Serialized, String, Time

Class Method Summary collapse

Class Method Details

.[](type) ⇒ Object



25
26
27
# File 'lib/ohm/contrib/typecast.rb', line 25

def self.[](type)
  const_get(type.to_s.split('::').last)
end

.defined?(type) ⇒ Boolean



20
21
22
23
# File 'lib/ohm/contrib/typecast.rb', line 20

def self.defined?(type)
  @constants ||= constants.map(&:to_s)
  @constants.include?(type.to_s)
end