Module: DataClass::ClassMethods

Defined in:
lib/emery/dataclass.rb

Instance Method Summary collapse

Instance Method Details

#typed_attributesObject



51
52
53
# File 'lib/emery/dataclass.rb', line 51

def typed_attributes
  @typed_attributes
end

#val(name, type) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/emery/dataclass.rb', line 55

def val(name, type)
  if @typed_attributes == nil
    @typed_attributes = {}
  end
  @typed_attributes[name] = type
  attr_reader name
end

#var(name, type) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/emery/dataclass.rb', line 63

def var(name, type)
  if @typed_attributes == nil
    @typed_attributes = {}
  end
  @typed_attributes[name] = type
  attr_accessor name
end