Class: Serde::Serializer
- Inherits:
-
Object
- Object
- Serde::Serializer
- Defined in:
- lib/serde.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object) ⇒ Serializer
constructor
A new instance of Serializer.
- #to_json ⇒ Object
Constructor Details
#initialize(object) ⇒ Serializer
Returns a new instance of Serializer.
25 26 27 |
# File 'lib/serde.rb', line 25 def initialize(object) @args = self.class.get_schema.keys.map { |k| object.public_send(k) } end |
Class Method Details
.get_schema ⇒ Object
20 21 22 |
# File 'lib/serde.rb', line 20 def get_schema @schema end |
.schema(**attrs) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/serde.rb', line 10 def schema(**attrs) @schema = attrs SerializerGenerator.call(self) Dir.chdir(File.('../_target_', __dir__)) do `make` end require_relative '../_target_/serde_rb/serde_rb' end |
Instance Method Details
#to_json ⇒ Object
29 30 31 |
# File 'lib/serde.rb', line 29 def to_json internal_to_json(*@args) end |