hash_conditions 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
data/lib/hash_conditions/core.rb
CHANGED
@@ -146,7 +146,7 @@ module HashConditions
|
|
146
146
|
case parser
|
147
147
|
when String then options[:result].call(extract_expression( parser, condition ), options)
|
148
148
|
when Hash then _ext_read_module( { '$eval' => [ parser, op, value ] }, options )
|
149
|
-
when Proc then _ext_read_module( parser.call( key, condition ), options )
|
149
|
+
when Proc then _ext_read_module( parser.call( key, condition, options ), options )
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
@@ -3,7 +3,7 @@ module HashConditions
|
|
3
3
|
extend Core
|
4
4
|
|
5
5
|
def self.get_conditions conditions, options = {}
|
6
|
-
|
6
|
+
options = options.merge \
|
7
7
|
operation: :parse,
|
8
8
|
result: lambda{ | expression, options |
|
9
9
|
_parse_key_value_condition expression
|
@@ -12,6 +12,8 @@ module HashConditions
|
|
12
12
|
"( #{ array.join( " #{ options[:glue].upcase } " ) } )"
|
13
13
|
}
|
14
14
|
|
15
|
+
result = iterator conditions, options
|
16
|
+
|
15
17
|
result.
|
16
18
|
gsub!(/^\( /, '').
|
17
19
|
gsub!(/ \)$/, '')
|
@@ -40,7 +42,7 @@ module HashConditions
|
|
40
42
|
def self._parse_value value, prepend = '', append = ''
|
41
43
|
case value
|
42
44
|
when String then "'#{prepend}#{value}#{append}'"
|
43
|
-
when DateTime, Date, Time then "'#{value.strftime("%Y-%m-%d %
|
45
|
+
when DateTime, Date, Time then "'#{value.strftime("%Y-%m-%d %H:%M")}'"
|
44
46
|
when Integer, Float then "#{value}"
|
45
47
|
end
|
46
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_conditions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
hash:
|
105
|
+
hash: 1535850409122845806
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
segments:
|
113
113
|
- 0
|
114
|
-
hash:
|
114
|
+
hash: 1535850409122845806
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
117
|
rubygems_version: 1.8.23
|