expressir 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +15 -1
  3. data/Gemfile +0 -1
  4. data/exe/{format-test → expressir-format-test} +1 -1
  5. data/expressir.gemspec +2 -2
  6. data/lib/expressir/liquid/cache_drop.rb +20 -0
  7. data/lib/expressir/liquid/data_type_drop.rb +8 -0
  8. data/lib/expressir/liquid/data_types/aggregate_drop.rb +21 -0
  9. data/lib/expressir/liquid/data_types/array_drop.rb +34 -0
  10. data/lib/expressir/liquid/data_types/bag_drop.rb +26 -0
  11. data/lib/expressir/liquid/data_types/binary_drop.rb +22 -0
  12. data/lib/expressir/liquid/data_types/boolean_drop.rb +10 -0
  13. data/lib/expressir/liquid/data_types/enumeration_drop.rb +30 -0
  14. data/lib/expressir/liquid/data_types/enumeration_item_drop.rb +17 -0
  15. data/lib/expressir/liquid/data_types/generic_drop.rb +17 -0
  16. data/lib/expressir/liquid/data_types/generic_entity_drop.rb +17 -0
  17. data/lib/expressir/liquid/data_types/integer_drop.rb +10 -0
  18. data/lib/expressir/liquid/data_types/list_drop.rb +30 -0
  19. data/lib/expressir/liquid/data_types/logical_drop.rb +10 -0
  20. data/lib/expressir/liquid/data_types/number_drop.rb +10 -0
  21. data/lib/expressir/liquid/data_types/real_drop.rb +18 -0
  22. data/lib/expressir/liquid/data_types/select_drop.rb +34 -0
  23. data/lib/expressir/liquid/data_types/set_drop.rb +26 -0
  24. data/lib/expressir/liquid/data_types/string_drop.rb +22 -0
  25. data/lib/expressir/liquid/declaration_drop.rb +8 -0
  26. data/lib/expressir/liquid/declarations/attribute_drop.rb +37 -0
  27. data/lib/expressir/liquid/declarations/constant_drop.rb +25 -0
  28. data/lib/expressir/liquid/declarations/entity_drop.rb +65 -0
  29. data/lib/expressir/liquid/declarations/function_drop.rb +93 -0
  30. data/lib/expressir/liquid/declarations/interface_drop.rb +30 -0
  31. data/lib/expressir/liquid/declarations/interface_item_drop.rb +22 -0
  32. data/lib/expressir/liquid/declarations/interfaced_item_drop.rb +34 -0
  33. data/lib/expressir/liquid/declarations/parameter_drop.rb +25 -0
  34. data/lib/expressir/liquid/declarations/procedure_drop.rb +89 -0
  35. data/lib/expressir/liquid/declarations/remark_item_drop.rb +22 -0
  36. data/lib/expressir/liquid/declarations/rule_drop.rb +105 -0
  37. data/lib/expressir/liquid/declarations/schema_drop.rb +91 -0
  38. data/lib/expressir/liquid/declarations/schema_version_drop.rb +26 -0
  39. data/lib/expressir/liquid/declarations/schema_version_item_drop.rb +22 -0
  40. data/lib/expressir/liquid/declarations/subtype_constraint_drop.rb +37 -0
  41. data/lib/expressir/liquid/declarations/type_drop.rb +37 -0
  42. data/lib/expressir/liquid/declarations/unique_rule_drop.rb +21 -0
  43. data/lib/expressir/liquid/declarations/variable_drop.rb +25 -0
  44. data/lib/expressir/liquid/declarations/where_rule_drop.rb +21 -0
  45. data/lib/expressir/liquid/expression_drop.rb +8 -0
  46. data/lib/expressir/liquid/expressions/aggregate_initializer_drop.rb +24 -0
  47. data/lib/expressir/liquid/expressions/aggregate_initializer_item_drop.rb +22 -0
  48. data/lib/expressir/liquid/expressions/binary_expression_drop.rb +26 -0
  49. data/lib/expressir/liquid/expressions/entity_constructor_drop.rb +26 -0
  50. data/lib/expressir/liquid/expressions/function_call_drop.rb +26 -0
  51. data/lib/expressir/liquid/expressions/interval_drop.rb +34 -0
  52. data/lib/expressir/liquid/expressions/query_expression_drop.rb +25 -0
  53. data/lib/expressir/liquid/expressions/unary_expression_drop.rb +22 -0
  54. data/lib/expressir/liquid/identifier_drop.rb +33 -0
  55. data/lib/expressir/liquid/literal_drop.rb +8 -0
  56. data/lib/expressir/liquid/literals/binary_drop.rb +18 -0
  57. data/lib/expressir/liquid/literals/integer_drop.rb +18 -0
  58. data/lib/expressir/liquid/literals/logical_drop.rb +18 -0
  59. data/lib/expressir/liquid/literals/real_drop.rb +18 -0
  60. data/lib/expressir/liquid/literals/string_drop.rb +22 -0
  61. data/lib/expressir/liquid/model_element_drop.rb +33 -0
  62. data/lib/expressir/liquid/reference_drop.rb +8 -0
  63. data/lib/expressir/liquid/references/attribute_reference_drop.rb +22 -0
  64. data/lib/expressir/liquid/references/group_reference_drop.rb +22 -0
  65. data/lib/expressir/liquid/references/index_reference_drop.rb +26 -0
  66. data/lib/expressir/liquid/references/simple_reference_drop.rb +22 -0
  67. data/lib/expressir/liquid/repository_drop.rb +22 -0
  68. data/lib/expressir/liquid/statement_drop.rb +8 -0
  69. data/lib/expressir/liquid/statements/alias_drop.rb +29 -0
  70. data/lib/expressir/liquid/statements/assignment_drop.rb +22 -0
  71. data/lib/expressir/liquid/statements/case_action_drop.rb +26 -0
  72. data/lib/expressir/liquid/statements/case_drop.rb +30 -0
  73. data/lib/expressir/liquid/statements/compound_drop.rb +22 -0
  74. data/lib/expressir/liquid/statements/escape_drop.rb +10 -0
  75. data/lib/expressir/liquid/statements/if_drop.rb +34 -0
  76. data/lib/expressir/liquid/statements/null_drop.rb +10 -0
  77. data/lib/expressir/liquid/statements/procedure_call_drop.rb +26 -0
  78. data/lib/expressir/liquid/statements/repeat_drop.rb +45 -0
  79. data/lib/expressir/liquid/statements/return_drop.rb +18 -0
  80. data/lib/expressir/liquid/statements/skip_drop.rb +10 -0
  81. data/lib/expressir/liquid/supertype_expression_drop.rb +8 -0
  82. data/lib/expressir/liquid/supertype_expressions/binary_supertype_expression_drop.rb +26 -0
  83. data/lib/expressir/liquid/supertype_expressions/oneof_supertype_expression_drop.rb +22 -0
  84. data/lib/expressir/liquid.rb +18 -0
  85. data/lib/expressir/model/model_element.rb +7 -0
  86. data/lib/expressir/version.rb +1 -1
  87. data/lib/expressir.rb +2 -0
  88. metadata +98 -8
  89. /data/exe/{format → expressir-format} +0 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Declarations
6
+ class WhereRuleDrop < ::Expressir::Liquid::DeclarationDrop
7
+ include ::Expressir::Liquid::IdentifierDrop
8
+
9
+ def initialize(model)
10
+ @model = model
11
+ initialize_identifier(@model)
12
+ super
13
+ end
14
+
15
+ def expression
16
+ drop_klass_by_model(@model.expression)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ class ExpressionDrop < ::Expressir::Liquid::ModelElementDrop
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class AggregateInitializerDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def items
13
+ return [] unless @model.items
14
+
15
+ @model.items.map do |item|
16
+ ::Expressir::Liquid::Expressions::AggregateInitializerItemDrop.new(
17
+ item,
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class AggregateInitializerItemDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def expression
13
+ drop_klass_by_model(@model.expression)
14
+ end
15
+
16
+ def repetition
17
+ drop_klass_by_model(@model.repetition)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class BinaryExpressionDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def operator
13
+ @model.operator
14
+ end
15
+
16
+ def operand1
17
+ drop_klass_by_model(@model.operand1)
18
+ end
19
+
20
+ def operand2
21
+ drop_klass_by_model(@model.operand2)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class EntityConstructorDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def entity
13
+ drop_klass_by_model(@model.entity)
14
+ end
15
+
16
+ def parameters
17
+ return [] unless @model.parameters
18
+
19
+ @model.parameters.map do |item|
20
+ drop_klass_by_model(item)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class FunctionCallDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def function
13
+ drop_klass_by_model(@model.function)
14
+ end
15
+
16
+ def parameters
17
+ return [] unless @model.parameters
18
+
19
+ @model.parameters.map do |item|
20
+ drop_klass_by_model(item)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class IntervalDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def low
13
+ drop_klass_by_model(@model.low)
14
+ end
15
+
16
+ def operator1
17
+ @model.operator1
18
+ end
19
+
20
+ def item
21
+ drop_klass_by_model(@model.item)
22
+ end
23
+
24
+ def operator2
25
+ @model.operator2
26
+ end
27
+
28
+ def high
29
+ drop_klass_by_model(@model.high)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class QueryExpressionDrop < ::Expressir::Liquid::ExpressionDrop
7
+ include ::Expressir::Liquid::IdentifierDrop
8
+
9
+ def initialize(model)
10
+ @model = model
11
+ initialize_identifier(@model)
12
+ super
13
+ end
14
+
15
+ def aggregate_source
16
+ drop_klass_by_model(@model.aggregate_source)
17
+ end
18
+
19
+ def expression
20
+ drop_klass_by_model(@model.expression)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Expressions
6
+ class UnaryExpressionDrop < ::Expressir::Liquid::ExpressionDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def operator
13
+ @model.operator
14
+ end
15
+
16
+ def operand
17
+ drop_klass_by_model(@model.operand)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "declarations/remark_item_drop"
4
+
5
+ module Expressir
6
+ module Liquid
7
+ module IdentifierDrop
8
+ def initialize_identifier(model)
9
+ @model = model
10
+ end
11
+
12
+ def id
13
+ @model.id
14
+ end
15
+
16
+ def remarks
17
+ @model.remarks || []
18
+ end
19
+
20
+ def remark_items
21
+ return [] unless @model.remark_items
22
+
23
+ @model.remark_items.map do |item|
24
+ ::Expressir::Liquid::RemarkItemDrop.new(item)
25
+ end
26
+ end
27
+
28
+ def source
29
+ @model.source
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ class LiteralDrop < ::Expressir::Liquid::ModelElementDrop
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Literals
6
+ class BinaryDrop < ::Expressir::Liquid::LiteralDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def value
13
+ @model.value
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Literals
6
+ class IntegerDrop < ::Expressir::Liquid::LiteralDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def value
13
+ @model.value
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Literals
6
+ class LogicalDrop < ::Expressir::Liquid::LiteralDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def value
13
+ @model.value
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Literals
6
+ class RealDrop < ::Expressir::Liquid::LiteralDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def value
13
+ @model.value
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Literals
6
+ class StringDrop < ::Expressir::Liquid::LiteralDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def value
13
+ @model.value
14
+ end
15
+
16
+ def encoded
17
+ @model.encoded
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ class ModelElementDrop < ::Liquid::Drop
6
+ def initialize(model) # rubocop:disable Lint/MissingSuper
7
+ @model = model
8
+ end
9
+
10
+ def _class
11
+ @model.class.name
12
+ end
13
+
14
+ def file
15
+ @model.file if @model.respond_to?(:file)
16
+ end
17
+
18
+ def source
19
+ @model.source if @model.respond_to?(:source)
20
+ end
21
+
22
+ private
23
+
24
+ def drop_klass_by_model(model)
25
+ return nil if model.nil?
26
+
27
+ klass_name = "#{model.class.name.gsub('::Model::', '::Liquid::')}Drop"
28
+ klass = Object.const_get(klass_name)
29
+ klass.new(model)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ class ReferenceDrop < ::Expressir::Liquid::ModelElementDrop
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module References
6
+ class AttributeReferenceDrop < ::Expressir::Liquid::ReferenceDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def ref
13
+ drop_klass_by_model(@model.ref)
14
+ end
15
+
16
+ def attribute
17
+ drop_klass_by_model(@model.attribute)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module References
6
+ class GroupReferenceDrop < ::Expressir::Liquid::ReferenceDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def ref
13
+ drop_klass_by_model(@model.ref)
14
+ end
15
+
16
+ def entity
17
+ drop_klass_by_model(@model.entity)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module References
6
+ class IndexReferenceDrop < ::Expressir::Liquid::ReferenceDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def ref
13
+ drop_klass_by_model(@model.ref)
14
+ end
15
+
16
+ def index1
17
+ drop_klass_by_model(@model.index1)
18
+ end
19
+
20
+ def index2
21
+ drop_klass_by_model(@model.index2)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module References
6
+ class SimpleReferenceDrop < ::Expressir::Liquid::ReferenceDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def id
13
+ @model.id
14
+ end
15
+
16
+ def base_path
17
+ @model.base_path
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "declarations/schema_drop"
4
+
5
+ module Expressir
6
+ module Liquid
7
+ class RepositoryDrop < ::Expressir::Liquid::ModelElementDrop
8
+ def initialize(model)
9
+ @model = model
10
+ super
11
+ end
12
+
13
+ def schemas
14
+ return [] unless @model.schemas
15
+
16
+ @model.schemas.map do |item|
17
+ ::Expressir::Liquid::Declarations::SchemaDrop.new(item)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ class StatementDrop < ::Expressir::Liquid::ModelElementDrop
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Statements
6
+ class AliasDrop < ::Expressir::Liquid::StatementDrop
7
+ include ::Expressir::Liquid::IdentifierDrop
8
+
9
+ def initialize(model)
10
+ @model = model
11
+ initialize_identifier(@model)
12
+ super
13
+ end
14
+
15
+ def expression
16
+ drop_klass_by_model(@model.expression)
17
+ end
18
+
19
+ def statements
20
+ return [] unless @model.statements
21
+
22
+ @model.statements.map do |item|
23
+ ::Expressir::Liquid::StatementDrop.new(item)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Statements
6
+ class AssignmentDrop < ::Expressir::Liquid::StatementDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def ref
13
+ drop_klass_by_model(@model.ref)
14
+ end
15
+
16
+ def expression
17
+ drop_klass_by_model(@model.expression)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Statements
6
+ class CaseActionDrop < ::Expressir::Liquid::StatementDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def labels
13
+ return [] unless @model.labels
14
+
15
+ @model.labels.map do |item|
16
+ drop_klass_by_model(item)
17
+ end
18
+ end
19
+
20
+ def statement
21
+ ::Expressir::Liquid::StatementDrop.new(@model.statement)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Liquid
5
+ module Statements
6
+ class CaseDrop < ::Expressir::Liquid::StatementDrop
7
+ def initialize(model)
8
+ @model = model
9
+ super
10
+ end
11
+
12
+ def expression
13
+ drop_klass_by_model(@model.expression)
14
+ end
15
+
16
+ def actions
17
+ return [] unless @model.actions
18
+
19
+ @model.actions.map do |item|
20
+ ::Expressir::Liquid::CaseActionDrop.new(item)
21
+ end
22
+ end
23
+
24
+ def otherwise_statement
25
+ ::Expressir::Liquid::StatementDrop.new(@model.otherwise_statement)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end