Class: CodelessCode::Filters::Date

Inherits:
Headers::Base show all
Defined in:
lib/codeless_code/filters/date.rb

Overview

Matches fables that were published on, before, or after a given date.

Defined Under Namespace

Classes: Matcher

Instance Method Summary collapse

Methods inherited from Headers::Base

#call, #enabled?

Constructor Details

#initialize(exact: nil, min: nil, max: nil, exclude: false) ⇒ Date

:reek:BooleanParameter



26
27
28
29
30
# File 'lib/codeless_code/filters/date.rb', line 26

def initialize(exact: nil, min: nil, max: nil, exclude: false)
  super('Date', exclude, [Matcher.parse(exact), :==],
                         [Matcher.parse(min),   :<=],
                         [Matcher.parse(max),   :>=])
end

Instance Method Details

#parse(val) ⇒ Object

:reek:UtilityFunction



33
34
35
# File 'lib/codeless_code/filters/date.rb', line 33

def parse(val)
  ::Date.parse(val)
end

#test_single(val, operator, test) ⇒ Object



37
38
39
# File 'lib/codeless_code/filters/date.rb', line 37

def test_single(val, operator, test)
  test.send(operator, val)
end