class AttributedObject::TypeDefaults

TypeDefaults is a option for default_to: - it will set defaults on the given type (integer: 0, boolean: false, string: ” etc)

Public Class Methods

new(args={}) click to toggle source
# File lib/attributed_object.rb, line 23
def initialize(args={})
  @args = {
    string: '',
    boolean: false,
    integer: 0,
    float: 0.0,
    numeric: 0,
    symbol: nil,
    array: [],
    hash: {}
  }.merge(args)
end

Public Instance Methods

fetch(type_info) click to toggle source
# File lib/attributed_object.rb, line 36
def fetch(type_info)
  @args.fetch(type_info, nil)
end