class Rosetta::Serializers::Base
Attributes
elements[R]
Public Class Methods
call(elements)
click to toggle source
# File lib/rosetta/serializers/base.rb, line 19 def call(elements) new(elements).call rescue StandardError raise SerializationError end
Also aliased as: serialize
inherited(new_serializer)
click to toggle source
# File lib/rosetta/serializers/base.rb, line 13 def inherited(new_serializer) key = new_serializer.name.match(/^(.*?)(Serializer)?$/)[1] key = key.split("::").last Serializers.register(key.underscore.to_sym, new_serializer) end
new(elements)
click to toggle source
# File lib/rosetta/serializers/base.rb, line 31 def initialize(elements) @elements = elements.dup.freeze validate_input! end
to_proc()
click to toggle source
# File lib/rosetta/serializers/base.rb, line 26 def to_proc proc { |*args, &block| self.call(*args, &block) } end
Public Instance Methods
call()
click to toggle source
# File lib/rosetta/serializers/base.rb, line 36 def call raise NotImplementedError end
Also aliased as: serialize
to_proc()
click to toggle source
# File lib/rosetta/serializers/base.rb, line 41 def to_proc proc { |*args, &block| self.call(*args, &block) } end