remi 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/remi/cucumber/business_rules.rb +6 -6
- data/lib/remi/project/features/formulas.feature +16 -12
- data/lib/remi/project/jobs/all_jobs_shared.rb +2 -0
- data/lib/remi/refinements/daru.rb +7 -5
- data/lib/remi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf39cdc119469c021fcdda710733129e1731525
|
4
|
+
data.tar.gz: dd3c3af30921359450fc2755ea384eeb2fa331e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 849b2bd95c4b4c0de5898cc255b3eeb46b677898ee69732f314157231b81e7ec406d17555489c34f9f862679b33be01651779dad21aae52115d2656f2cc9d30b
|
7
|
+
data.tar.gz: 298284e8eb1e7ce2b9b86b1925d9808eeaf73ccc79ef1c41316661cec61afdd49facddcab1addf8c682ebc24826b856a41ebbc77cfc1d760b734b8494d3f0c91
|
data/Gemfile.lock
CHANGED
@@ -32,8 +32,8 @@ module Remi::BusinessRules
|
|
32
32
|
|
33
33
|
def formulas
|
34
34
|
@formulas ||= Remi::Lookup::RegexSieve.new({
|
35
|
-
/(yesterday|tomorrow)/i => [:date_reference, :match_single_day],
|
36
|
-
/(last|previous|next) (day|month|year|week)/i => [:date_reference, :match_single_unit],
|
35
|
+
/(today|yesterday|tomorrow)/i => [:date_reference, :match_single_day],
|
36
|
+
/(this|last|previous|next) (day|month|year|week)/i => [:date_reference, :match_single_unit],
|
37
37
|
/(\d+)\s(day|days|month|months|year|years|week|weeks) (ago|from now)/i => [:date_reference, :match_multiple]
|
38
38
|
})
|
39
39
|
end
|
@@ -57,17 +57,17 @@ module Remi::BusinessRules
|
|
57
57
|
|
58
58
|
def date_reference_match_single_day(form, direction)
|
59
59
|
{
|
60
|
-
quantity: 1,
|
60
|
+
quantity: direction.downcase == 'today' ? 0 : 1,
|
61
61
|
unit: 'days',
|
62
|
-
direction: { 'yesterday' => 'ago', 'tomorrow' => 'since' }[direction.downcase]
|
62
|
+
direction: { 'today' => 'ago', 'yesterday' => 'ago', 'tomorrow' => 'since' }[direction.downcase]
|
63
63
|
}
|
64
64
|
end
|
65
65
|
|
66
66
|
def date_reference_match_single_unit(form, direction, unit)
|
67
67
|
{
|
68
|
-
quantity: 1,
|
68
|
+
quantity: direction.downcase == 'this' ? 0 : 1,
|
69
69
|
unit: unit.downcase.pluralize,
|
70
|
-
direction: { 'last' => 'ago', 'previous' => 'ago', 'next' => 'since' }[direction.downcase]
|
70
|
+
direction: { 'this' => 'ago', 'last' => 'ago', 'previous' => 'ago', 'next' => 'since' }[direction.downcase]
|
71
71
|
}
|
72
72
|
end
|
73
73
|
|
@@ -10,9 +10,10 @@ Feature: This tests the creation of example records.
|
|
10
10
|
Scenario: Handling date formulas in the example data with day units.
|
11
11
|
|
12
12
|
Given the following example record for 'Source Data':
|
13
|
-
| Yesterday | Tomorrow | OneDayAgo | SevenDaysAgo | ThreeDaysFromNow |
|
14
|
-
| *Yesterday* | *Tomorrow* | *1 day ago* | *7 days ago* | *3 days from now* |
|
15
|
-
Then the target field '
|
13
|
+
| Today | Yesterday | Tomorrow | OneDayAgo | SevenDaysAgo | ThreeDaysFromNow |
|
14
|
+
| *Today* | *Yesterday* | *Tomorrow* | *1 day ago* | *7 days ago* | *3 days from now* |
|
15
|
+
Then the target field 'Today' is the date 0 days ago
|
16
|
+
And the target field 'Yesterday' is the date 1 day ago
|
16
17
|
And the target field 'Tomorrow' is the date 1 day from now
|
17
18
|
And the target field 'OneDayAgo' is the date 1 day ago
|
18
19
|
And the target field 'SevenDaysAgo' is the date 7 days ago
|
@@ -21,9 +22,10 @@ Feature: This tests the creation of example records.
|
|
21
22
|
Scenario: Handling date formulas in the example data with month units.
|
22
23
|
|
23
24
|
Given the following example record for 'Source Data':
|
24
|
-
| LastMonth | NextMonth | OneMonthAgo | SevenMonthsAgo | ThreeMonthsFromNow |
|
25
|
-
| *Last Month* | *Next Month* | *1 month ago* | *7 months ago* | *3 months from now* |
|
26
|
-
Then the target field '
|
25
|
+
| ThisMonth | LastMonth | NextMonth | OneMonthAgo | SevenMonthsAgo | ThreeMonthsFromNow |
|
26
|
+
| *This Month* |*Last Month* | *Next Month* | *1 month ago* | *7 months ago* | *3 months from now* |
|
27
|
+
Then the target field 'ThisMonth' is the date 0 months ago
|
28
|
+
And the target field 'LastMonth' is the date 1 month ago
|
27
29
|
And the target field 'NextMonth' is the date 1 month from now
|
28
30
|
And the target field 'OneMonthAgo' is the date 1 month ago
|
29
31
|
And the target field 'SevenMonthsAgo' is the date 7 months ago
|
@@ -32,9 +34,10 @@ Feature: This tests the creation of example records.
|
|
32
34
|
Scenario: Handling date formulas in the example data with year units.
|
33
35
|
|
34
36
|
Given the following example record for 'Source Data':
|
35
|
-
| LastYear | NextYear | OneYearAgo | SevenYearsAgo | ThreeYearsFromNow |
|
36
|
-
| *Last Year* | *Next Year* | *1 year ago* | *7 years ago* | *3 years from now* |
|
37
|
-
Then the target field '
|
37
|
+
| ThisYear | LastYear | NextYear | OneYearAgo | SevenYearsAgo | ThreeYearsFromNow |
|
38
|
+
| *This Year* | *Last Year* | *Next Year* | *1 year ago* | *7 years ago* | *3 years from now* |
|
39
|
+
Then the target field 'ThisYear' is the date 0 years ago
|
40
|
+
And the target field 'LastYear' is the date 1 year ago
|
38
41
|
And the target field 'NextYear' is the date 1 year from now
|
39
42
|
And the target field 'OneYearAgo' is the date 1 year ago
|
40
43
|
And the target field 'SevenYearsAgo' is the date 7 years ago
|
@@ -43,9 +46,10 @@ Feature: This tests the creation of example records.
|
|
43
46
|
Scenario: Handling date formulas in the example data with week units.
|
44
47
|
|
45
48
|
Given the following example record for 'Source Data':
|
46
|
-
| LastWeek | NextWeek | OneWeekAgo | SevenWeeksAgo | ThreeWeeksFromNow |
|
47
|
-
| *Last Week* | *Next Week* | *1 week ago* | *7 weeks ago* | *3 weeks from now* |
|
48
|
-
Then the target field '
|
49
|
+
| ThisWeek | LastWeek | NextWeek | OneWeekAgo | SevenWeeksAgo | ThreeWeeksFromNow |
|
50
|
+
| *This Week* | *Last Week* | *Next Week* | *1 week ago* | *7 weeks ago* | *3 weeks from now* |
|
51
|
+
Then the target field 'ThisWeek' is the date 0 week ago
|
52
|
+
And the target field 'LastWeek' is the date 1 week ago
|
49
53
|
And the target field 'NextWeek' is the date 1 week from now
|
50
54
|
And the target field 'OneWeekAgo' is the date 1 week ago
|
51
55
|
And the target field 'SevenWeeksAgo' is the date 7 weeks ago
|
@@ -18,11 +18,6 @@ module Remi
|
|
18
18
|
File.write(filename, Marshal.dump(self.to_hash))
|
19
19
|
end
|
20
20
|
|
21
|
-
# Public: Creates a DataFrame by reading the dumped version from a file.
|
22
|
-
def self.from_hash_dump(filename)
|
23
|
-
::Daru::DataFrame.new(Marshal.load(File.read(filename)))
|
24
|
-
end
|
25
|
-
|
26
21
|
# Public: Allows the user to define an arbitrary aggregation function.
|
27
22
|
#
|
28
23
|
# by - The name of the DataFrame vector to use to group records.
|
@@ -53,6 +48,13 @@ module Remi
|
|
53
48
|
end
|
54
49
|
|
55
50
|
end
|
51
|
+
|
52
|
+
refine ::Daru::DataFrame.singleton_class do
|
53
|
+
# Public: Creates a DataFrame by reading the dumped version from a file.
|
54
|
+
def from_hash_dump(filename)
|
55
|
+
::Daru::DataFrame.new(Marshal.load(File.read(filename)))
|
56
|
+
end
|
57
|
+
end
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
data/lib/remi/version.rb
CHANGED