Class: Rabbit::ImageManipulable::Dia
Constant Summary collapse
- DIA_COMMANDS =
%w(dia)
Constants included from ModuleLoader
Instance Attribute Summary
Attributes inherited from Base
#animation, #height, #original_height, #original_width, #width
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename, keep_ratio) ⇒ Dia
constructor
A new instance of Dia.
Methods included from SystemRunner
Methods inherited from Base
#[], #[]=, #draw, #keep_ratio, #keep_ratio=, #pixbuf, #resize
Methods included from ModuleLoader
extend_object, #find_loader, #loaders, #push_loader, #unshift_loader
Constructor Details
#initialize(filename, keep_ratio) ⇒ Dia
Returns a new instance of Dia.
43 44 45 46 |
# File 'lib/rabbit/image/dia.rb', line 43 def initialize(filename, keep_ratio) init_svg_loader(filename, keep_ratio) super end |
Class Method Details
.match?(filename) ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rabbit/image/dia.rb', line 18 def match?(filename) return true if File.extname(filename).downcase.end_with?(".dia") File.open(filename) do |f| begin first_line = f.gets second_line = f.gets return false unless second_line return false unless first_line.start_with?("<?xml") return false unless second_line.start_with?("<dia:diagram") true rescue EncodingError false end end end |