Class: Xpub::CallBook::CallImgFiles
- Inherits:
-
Object
- Object
- Xpub::CallBook::CallImgFiles
- Defined in:
- lib/xpub/dsl/src_file.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
- #full_path ⇒ Object
- #img_files ⇒ Object
-
#initialize(dir) ⇒ CallImgFiles
constructor
A new instance of CallImgFiles.
- #validate ⇒ Object
Constructor Details
#initialize(dir) ⇒ CallImgFiles
Returns a new instance of CallImgFiles.
40 41 42 |
# File 'lib/xpub/dsl/src_file.rb', line 40 def initialize(dir) @dir = dir end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
38 39 40 |
# File 'lib/xpub/dsl/src_file.rb', line 38 def dir @dir end |
Instance Method Details
#full_path ⇒ Object
44 45 46 |
# File 'lib/xpub/dsl/src_file.rb', line 44 def full_path "#{Dir.getwd}/src/#{@dir}" end |
#img_files ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/xpub/dsl/src_file.rb', line 52 def img_files validate Dir.glob("#{full_path}/**/*.{jpeg,jpg,png,bmp,pdf}").sort.map do |path| img = CallImgFile.new path.sub(full_path + '/', '') img.validate img end end |
#validate ⇒ Object
48 49 50 |
# File 'lib/xpub/dsl/src_file.rb', line 48 def validate raise "Image Dir does not exist.#{full_path}" unless Dir.exist? full_path end |