class OFX::Data::Serialization::Registry

Attributes

entries[R]

Public Class Methods

build(&block) click to toggle source
# File lib/ofx/data/serialization/registry.rb, line 7
def self.build(&block)
  registry = new
  block.call(registry)
  registry
end
new() click to toggle source
# File lib/ofx/data/serialization/registry.rb, line 15
def initialize
  @entries = []
end

Public Instance Methods

matching_entry(ofx_type, context_name) click to toggle source
# File lib/ofx/data/serialization/registry.rb, line 23
def matching_entry(ofx_type, context_name)
  match = entries.find { |entry| entry.match?(ofx_type, context_name) }
  raise SerializerNotFoundError.generate(ofx_type, context_name) if match.nil?
  match
end
register(entry) click to toggle source
# File lib/ofx/data/serialization/registry.rb, line 19
def register(entry)
  entries << entry
end
serializer_for(ofx_type, context_name = nil) click to toggle source
# File lib/ofx/data/serialization/registry.rb, line 29
def serializer_for(ofx_type, context_name = nil)
  matching_entry(ofx_type, context_name).serializer
end