Module: Microstation::FileTests
- Included in:
- Changer
- Defined in:
- lib/microstation/file_tests.rb
Instance Method Summary collapse
- #check_is_dgn(f) ⇒ Object
- #check_is_drawing(f) ⇒ Object
- #drawing?(f) ⇒ Boolean
- #drawing_type?(f) ⇒ Boolean
- #microstation_drawing?(f) ⇒ Boolean
Instance Method Details
#check_is_dgn(f) ⇒ Object
29 30 31 |
# File 'lib/microstation/file_tests.rb', line 29 def check_is_dgn(f) raise ArgumentError, 'File must be a dgn file' unless microstation_drawing?(f) end |
#check_is_drawing(f) ⇒ Object
26 27 28 |
# File 'lib/microstation/file_tests.rb', line 26 def check_is_drawing(f) raise ArgumentError, 'File must be a dgn or dwg file' unless drawing?(f) end |
#drawing?(f) ⇒ Boolean
12 13 14 15 16 |
# File 'lib/microstation/file_tests.rb', line 12 def drawing?(f) f = f.to_path if f.respond_to? :to_path f = f.to_str File.file?(f) && drawing_type?(f) end |
#drawing_type?(f) ⇒ Boolean
19 20 21 22 23 24 |
# File 'lib/microstation/file_tests.rb', line 19 def drawing_type?(f) f = f.to_path if f.respond_to? :to_path f = f.to_str ext = File.extname(f) ext == '.dwg' || ext == '.dgn' end |
#microstation_drawing?(f) ⇒ Boolean
6 7 8 9 10 |
# File 'lib/microstation/file_tests.rb', line 6 def microstation_drawing?(f) f = f.to_path if f.respond_to? :to_path f = f.to_str File.file?(f) && File.extname(f) == '.dgn' end |