lutaml 0.4.1.pre.alpha → 0.4.1.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9856bef749609c2186daef72d9cac2275abdf35dee480be0658700d20e0f9e31
4
- data.tar.gz: f5a0c9decbf6188da822b39655ee14d048387783b28d92a5fa280781e6c02a16
3
+ metadata.gz: 1f585ad7b175177afe9ac1e3c9a243a7d7f5b4f471eab0268db07c5416071ed7
4
+ data.tar.gz: 04ea818d961eb1b594f41417a73785d4be620acc81301a1da8f98faa9dae4b2d
5
5
  SHA512:
6
- metadata.gz: f4ccdf6b1a8ef299ce9a255b9615595f68ed6d07159808983451fe637cbda6747d71a03171c49d21f0b2797346e0daca0a9e94a8e55ca9614e734d54588a2b65
7
- data.tar.gz: 37e385085efc088644b1d582144e5436ad5e4310899f25f4fbfafa090302410d8ce3343601a9c2250b4ac57f3a073b1c996bdbcd982602d6c58a7fc0197c3321
6
+ metadata.gz: 34dd93e727898bd84c2257dd8d0e10d7f731775d11efc9f9109a2113a382779c00fb1b0be9bcffd174e2610503e12993c0d2306bb629d2f700f970206deddb90
7
+ data.tar.gz: f754762c5197831a3cceba0a46cbe2868ae13e40b69f05e1e5d6c08c4ea4c8b69cb045c960833a5d1bbdcfb7fb0316d382795099330325725e16feae736fab33
@@ -12,40 +12,10 @@ module Lutaml
12
12
  def serialize_document(repository)
13
13
  repository.schemas.each_with_object({}) do |schema, res|
14
14
  res["schemas"] ||= []
15
- res[schema.id] = serialize_value(schema).merge(SOURCE_CODE_ATTRIBUTE_NAME => entity_source_code(schema))
15
+ res[schema.id] = schema.to_hash(formatter: Expressir::ExpressExp::Formatter)
16
16
  res["schemas"].push(res[schema.id])
17
17
  end
18
18
  end
19
-
20
- def serialize_value(object)
21
- object.instance_variables.each_with_object({}) do |var, res|
22
- variable = object.instance_variable_get(var)
23
- if variable.respond_to?(:to_hash)
24
- res[var.to_s.gsub("@", "")] = variable.to_hash.merge(SOURCE_CODE_ATTRIBUTE_NAME => entity_source_code(variable))
25
- elsif variable.is_a?(Array)
26
- res[var.to_s.gsub("@", "")] = variable.map do |entity|
27
- if entity.respond_to?(:to_hash)
28
- entity.to_hash.merge(SOURCE_CODE_ATTRIBUTE_NAME => entity_source_code(entity))
29
- else
30
- entity
31
- end
32
- end
33
- else
34
- res[var.to_s.gsub("@", "")] = variable
35
- end
36
- end
37
- end
38
-
39
- def merge_source_code_attr(serialized_entries, entities)
40
- serialized_entries.map do |serialized|
41
- entity = entities.detect { |n| n.id == serialized["id"] }
42
- serialized.merge(SOURCE_CODE_ATTRIBUTE_NAME => entity_source_code(entity))
43
- end
44
- end
45
-
46
- def entity_source_code(entity)
47
- Expressir::ExpressExp::Formatter.format(entity)
48
- end
49
19
  end
50
20
  end
51
21
  end
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.4.1-alpha".freeze
2
+ VERSION = "0.4.1-alpha.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1.pre.alpha
4
+ version: 0.4.1.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.