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_dgn?(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
25 26 27 |
# File 'lib/microstation/file_tests.rb', line 25 def check_is_drawing(f) raise ArgumentError, "File must be a dgn or dwg file" unless drawing?(f) end |
#drawing?(f) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/microstation/file_tests.rb', line 14 def drawing?(f) return true if drawing_type?(f) f = f&.to_path&.to_str drawing_type(f) end |
#drawing_dgn?(f) ⇒ Boolean
10 11 12 |
# File 'lib/microstation/file_tests.rb', line 10 def drawing_dgn?(f) File.file?(f) && File.extname(f) == ".dgn" end |
#drawing_type?(f) ⇒ Boolean
21 22 23 |
# File 'lib/microstation/file_tests.rb', line 21 def drawing_type?(f) File.file?(f) && (File.extname(f) == ".dgn" || File.extname(f) == ".dwg") end |
#microstation_drawing?(f) ⇒ Boolean
3 4 5 6 7 8 |
# File 'lib/microstation/file_tests.rb', line 3 def microstation_drawing?(f) return true if drawing_dgn?(f) f = f&.to_path&.to_str drawing_dgn?(f) end |