Class: PiSlides::ImageDir
- Inherits:
-
Struct
- Object
- Struct
- PiSlides::ImageDir
- Defined in:
- lib/pi_slides/image_dir.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path
3 4 5 |
# File 'lib/pi_slides/image_dir.rb', line 3 def path @path end |
Instance Method Details
#file_list(pattern = '**/*.jpg') ⇒ Object
4 5 6 |
# File 'lib/pi_slides/image_dir.rb', line 4 def file_list(pattern = '**/*.jpg') @file_list ||= Dir[File.join(path, pattern)].shuffle end |
#random_file ⇒ Object
12 13 14 |
# File 'lib/pi_slides/image_dir.rb', line 12 def random_file file_list.pop end |
#reset ⇒ Object
8 9 10 |
# File 'lib/pi_slides/image_dir.rb', line 8 def reset @file_list = nil end |
#size ⇒ Object
16 17 18 |
# File 'lib/pi_slides/image_dir.rb', line 16 def size file_list.size end |