safrano 0.4.1 → 0.4.2

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.
@@ -1,3 +1,3 @@
1
1
  module Safrano
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'.freeze
3
3
  end
@@ -23,7 +23,6 @@ class String
23
23
  end
24
24
 
25
25
  class PathNode < String
26
- attr_reader :table_name
27
26
  attr_accessor :model_class
28
27
  attr_accessor :path_str
29
28
  def initialize(str, start_model)
@@ -80,14 +79,14 @@ class QPath
80
79
  path_nodes = []
81
80
  start_node.path_str = path_str
82
81
  nodes = [start_node]
83
- nodes.concat @qpath.split('/').map { |nstr| @start_model.create_path_node(nstr) }
84
- if (ns = nodes.size) > 1
85
- nodes[0...-1].each_with_index do |node, i|
86
- nodes[i + 1].set_model_class_by_parent_model(node.model_class)
87
- path_nodes << nodes[i + 1]
88
- nodes[i + 1].path_str = path_nodes.join('/')
89
- @segments << [node, nodes[i + 1]]
90
- end
82
+ nodes.concat(@qpath.split('/').map { |nstr| @start_model.create_path_node(nstr) })
83
+ return unless nodes.size > 1
84
+
85
+ nodes[0...-1].each_with_index do |node, i|
86
+ nodes[i + 1].set_model_class_by_parent_model(node.model_class)
87
+ path_nodes << nodes[i + 1]
88
+ nodes[i + 1].path_str = path_nodes.join('/')
89
+ @segments << [node, nodes[i + 1]]
91
90
  end
92
91
  end
93
92
  end
@@ -95,6 +94,7 @@ end
95
94
  class JoinByPathsHelper < Set
96
95
  attr_reader :result
97
96
  attr_reader :start_model
97
+ EMPTY_ARRAY = [].freeze
98
98
 
99
99
  def initialize(smodel)
100
100
  super()
@@ -102,7 +102,7 @@ class JoinByPathsHelper < Set
102
102
  end
103
103
 
104
104
  def build_unique_join_segments
105
- return (@result = []) if empty?
105
+ return (@result = EMPTY_ARRAY) if empty?
106
106
 
107
107
  maxlen = map(&:size).max
108
108
  iset = nil
@@ -118,6 +118,7 @@ class JoinByPathsHelper < Set
118
118
  jseg.map do |seg|
119
119
  leftm = seg.first.model_class
120
120
  assoc = leftm.association_reflection(seg.last.to_sym)
121
+
121
122
  rightm = seg.last.model_class
122
123
  # cf. documentation in sequel/model/associations.rb
123
124
  case assoc[:type]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - D.M.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-17 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -123,6 +123,7 @@ files:
123
123
  - lib/odata/common_logger.rb
124
124
  - lib/odata/entity.rb
125
125
  - lib/odata/error.rb
126
+ - lib/odata/expand.rb
126
127
  - lib/odata/filter/error.rb
127
128
  - lib/odata/filter/parse.rb
128
129
  - lib/odata/filter/sequel.rb
@@ -130,6 +131,7 @@ files:
130
131
  - lib/odata/filter/tree.rb
131
132
  - lib/odata/navigation_attribute.rb
132
133
  - lib/odata/relations.rb
134
+ - lib/odata/select.rb
133
135
  - lib/odata/url_parameters.rb
134
136
  - lib/odata/walker.rb
135
137
  - lib/safrano.rb
@@ -169,5 +171,5 @@ requirements: []
169
171
  rubygems_version: 3.1.2
170
172
  signing_key:
171
173
  specification_version: 4
172
- summary: Safrano is a Ruby OData server based on Sequel and Rack
174
+ summary: Safrano is a Ruby OData server library based on Sequel and Rack
173
175
  test_files: []