de 0.0.5 → 0.0.6
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.
- data/lib/de/de.rb +20 -13
- data/lib/de/sunspot_solr/search.rb +5 -4
- data/lib/de/version.rb +1 -1
- metadata +4 -4
data/lib/de/de.rb
CHANGED
@@ -114,23 +114,30 @@ module De
|
|
114
114
|
str
|
115
115
|
end
|
116
116
|
|
117
|
-
def
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
:children => children.map { |child| child.to_hash }
|
123
|
-
}
|
117
|
+
def copy
|
118
|
+
obj = self.clone
|
119
|
+
obj.parent = nil
|
120
|
+
|
121
|
+
obj
|
124
122
|
end
|
125
123
|
|
126
|
-
|
124
|
+
# def to_hash
|
125
|
+
# {
|
126
|
+
# :name => @name,
|
127
|
+
# :content => @content,
|
128
|
+
# :class => self.class.name,
|
129
|
+
# :children => children.map { |child| child.to_hash }
|
130
|
+
# }
|
131
|
+
# end
|
127
132
|
|
128
|
-
|
129
|
-
raise Error::InvalidExpressionError if (hash.keys - [:name, :content, :class, :children]).length > 0
|
133
|
+
class << self
|
130
134
|
|
131
|
-
|
132
|
-
hash
|
133
|
-
|
135
|
+
# def load(hash)
|
136
|
+
# raise Error::InvalidExpressionError if (hash.keys - [:name, :content, :class, :children]).length > 0
|
137
|
+
#
|
138
|
+
# obj = hash[:class].constantize.send(:new, hash[:name], hash[:content])
|
139
|
+
# hash[:children].each { |child| obj << load(child) }
|
140
|
+
# end
|
134
141
|
end
|
135
142
|
|
136
143
|
private
|
@@ -126,7 +126,8 @@ module De
|
|
126
126
|
# Search object
|
127
127
|
#
|
128
128
|
def &(obj)
|
129
|
-
|
129
|
+
children = (self.children + obj.children).collect { |child| child.copy }
|
130
|
+
Search.new("#{@name}+#{obj.name}", @klass, @options, children)
|
130
131
|
end
|
131
132
|
|
132
133
|
#
|
@@ -146,12 +147,12 @@ module De
|
|
146
147
|
[self, obj].select { |element| element.has_children? }.each do |element|
|
147
148
|
if element.children.length == 1
|
148
149
|
if element.first_child.is_a?(De::SunspotSolr::Or)
|
149
|
-
element.first_child.children.each { |child| expression_content << child }
|
150
|
+
element.first_child.children.each { |child| expression_content << child.copy }
|
150
151
|
else
|
151
|
-
expression_content << element.first_child
|
152
|
+
expression_content << element.first_child.copy
|
152
153
|
end
|
153
154
|
else
|
154
|
-
expression_content << SunspotSolr::And.new(element.children)
|
155
|
+
expression_content << SunspotSolr::And.new(element.children.collect { |child| child.copy })
|
155
156
|
end
|
156
157
|
end
|
157
158
|
|
data/lib/de/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: de
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Olga Gorun
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-23 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|