Module: Jat::Plugins::Types

Defined in:
lib/jat/plugins/types/types.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.after_load(jat_class, **_opts) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/jat/plugins/types/types.rb', line 14

def self.after_load(jat_class, **_opts)
  jat_class.config[:types] = {
    array: ->(value) { Array(value) },
    bool: ->(value) { !!value },
    float: ->(value) { Float(value) },
    hash: ->(value) { Hash(value) },
    int: ->(value) { Integer(value) },
    str: ->(value) { String(value) }
  }
end

.load(jat_class, **_opts) ⇒ Object



10
11
12
# File 'lib/jat/plugins/types/types.rb', line 10

def self.load(jat_class, **_opts)
  jat_class::Attribute.include(InstanceMethods)
end

.plugin_nameObject



6
7
8
# File 'lib/jat/plugins/types/types.rb', line 6

def self.plugin_name
  :types
end