Module: Saru::List::UnlockedDate

Includes:
Support::TimeConverter
Included in:
Saru::List
Defined in:
lib/saru/list/unlocked_date.rb

Instance Method Summary collapse

Methods included from Support::TimeConverter

#to_unix

Instance Method Details

#unlocked_after(date) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/saru/list/unlocked_date.rb', line 8

def unlocked_after date
  selected = items.select do |item|
    !item.unlocked_date.nil? &&
    item.unlocked_date > to_unix(date)
  end

  Saru::List.new selected
end

#unlocked_before(date) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/saru/list/unlocked_date.rb', line 17

def unlocked_before date
  selected = items.select do |item|
    !item.unlocked_date.nil? &&
    item.unlocked_date < to_unix(date)
  end

  Saru::List.new selected
end

#unlocked_between(start_date, end_date) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/saru/list/unlocked_date.rb', line 26

def unlocked_between start_date, end_date
  selected = items.select do |item|
    !item.unlocked_date.nil? &&
    item.unlocked_date > to_unix(start_date) &&
    item.unlocked_date < to_unix(end_date)
  end

  Saru::List.new selected
end