Class: Rdayone::Finder

Inherits:
Object
  • Object
show all
Defined in:
lib/rdayone/finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Finder

Returns a new instance of Finder.



5
6
7
# File 'lib/rdayone/finder.rb', line 5

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/rdayone/finder.rb', line 3

def path
  @path
end

Instance Method Details

#find_entriesObject



9
10
11
# File 'lib/rdayone/finder.rb', line 9

def find_entries
  EntryList.new(Dir["#{@path}/entries/*.doentry"], self)
end

#find_photo_for(uuid) ⇒ Object



13
14
15
# File 'lib/rdayone/finder.rb', line 13

def find_photo_for(uuid)
  Dir["#{@path}/photos/#{uuid}.jpg"].map { |f| File.expand_path(f) }[0]
end

#uuid_from_path(path) ⇒ Object



17
18
19
# File 'lib/rdayone/finder.rb', line 17

def uuid_from_path(path)
  File.basename(path, ".*")
end