Sha256: 3133bc647ad7c626f5c86dc1821f2a7902c3b5635a11a73bb823f3e7b5a53645
Contents?: true
Size: 899 Bytes
Versions: 16
Compression:
Stored size: 899 Bytes
Contents
module Eco module Language module Models class AttributeParser attr_reader :attr def initialize(attr, dependencies: {}) @attr = attr @dependencies = dependencies end def def_parser(&block) @parser = block self end def def_serializer(&block) @serializer = block self end def parse(source, dependencies: {}) raise "There is no parser for this attribue '#{attr}'" if !@parser @parser.call(source, @dependencies.merge(dependencies), attr) end def serialize(object, dependencies: {}) raise "There is no serializer for this attribue '#{attr}'" if !@serializer @serializer.call(object, @dependencies.merge(dependencies), attr) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems