Module: Diary::Item::Finder

Included in:
Base
Defined in:
lib/diary/item/finder.rb

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
# File 'lib/diary/item/finder.rb', line 12

def all
  file_list.map do |p|
    initialize_item(p)
  end
end

#find(r) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/diary/item/finder.rb', line 4

def find(r)
  file_list.each do |p|
    return initialize_item(p) if p.match(r)
  end

  nil
end

#firstObject



18
19
20
# File 'lib/diary/item/finder.rb', line 18

def first
  all.first
end

#lastObject



22
23
24
# File 'lib/diary/item/finder.rb', line 22

def last
  all.last
end