Class: TypedAttributes::Parser::EnumType

Inherits:
SymbolType show all
Defined in:
lib/typed_attributes/parser/enum_type.rb

Instance Attribute Summary

Attributes inherited from BaseType

#attribute, #model, #options

Instance Method Summary collapse

Methods inherited from BaseType

#initialize, #readers, #storage_var, #writers

Constructor Details

This class inherits a constructor from TypedAttributes::Parser::BaseType

Instance Method Details

#parse(value) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/typed_attributes/parser/enum_type.rb', line 5

def parse(value)
  value_sym = super(value)
  if options[:from] 
    if options[:from].include?(value_sym)
      value_sym
    else
      nil
    end
  else
    value_sym
  end
end