remi 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92b5bf2de20c5287b1879fb4602e39e71da6f6a7
4
- data.tar.gz: 05071d5457f84bbc42cf14fc4ee566c658492962
3
+ metadata.gz: abf39cdc119469c021fcdda710733129e1731525
4
+ data.tar.gz: dd3c3af30921359450fc2755ea384eeb2fa331e6
5
5
  SHA512:
6
- metadata.gz: d41fdb4d52f15b3632538fffc3d987c35b204ddb3a68f06db71ab44073884250ec7be7495531fa2965365a4d41a9508bb346d31dd91c203c877b4ed5821c83d3
7
- data.tar.gz: 92be48c0d23b22dbcfbaca25a43e94edda2c89947abf6505425a6439a665b99f39e317daaf6190bf4f0e3c7086ae73178c2dd688c400aeefefd8c736963c7264
6
+ metadata.gz: 849b2bd95c4b4c0de5898cc255b3eeb46b677898ee69732f314157231b81e7ec406d17555489c34f9f862679b33be01651779dad21aae52115d2656f2cc9d30b
7
+ data.tar.gz: 298284e8eb1e7ce2b9b86b1925d9808eeaf73ccc79ef1c41316661cec61afdd49facddcab1addf8c682ebc24826b856a41ebbc77cfc1d760b734b8494d3f0c91
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- remi (0.2.3)
4
+ remi (0.2.4)
5
5
  activesupport (~> 4.2)
6
6
  bond (~> 0.5)
7
7
  cucumber (~> 2.1)
@@ -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 'Yesterday' is the date 1 day ago
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 'LastMonth' is the date 1 month ago
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 'LastYear' is the date 1 year ago
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 'LastWeek' is the date 1 week ago
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
@@ -6,6 +6,8 @@ require 'remi'
6
6
 
7
7
  module AllJobsShared
8
8
  include Remi::Job
9
+ include Remi::Refinements::Daru
10
+ using Remi::Refinements::Daru
9
11
 
10
12
  define_param :sftp, {
11
13
  host: 'example.com',
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Remi
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sterling Paramore