Class: Rabbit::ImageManipulable::Dia
Constant Summary collapse
- DIA_COMMANDS =
%w(dia)
Constants included from ModuleLoader
Instance Attribute Summary
Attributes inherited from Base
#animation, #filename, #original_height, #original_width, #properties
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename, props) ⇒ Dia
constructor
A new instance of Dia.
Methods included from SystemRunner
Methods inherited from Base
#[], #[]=, #draw, #height, #keep_ratio=, #keep_ratio?, #pixbuf, #relative_clip_height, #relative_clip_width, #relative_clip_x, #relative_clip_y, #resize, #width
Methods included from ModuleLoader
extend_object, #find_loader, #loaders, #push_loader, #unshift_loader
Constructor Details
#initialize(filename, props) ⇒ Dia
Returns a new instance of Dia.
58 59 60 61 |
# File 'lib/rabbit/image/dia.rb', line 58 def initialize(filename, props) init_svg_loader(filename, props) super end |
Class Method Details
.match?(filename) ⇒ Boolean
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rabbit/image/dia.rb', line 33 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 |