Class: Rsvg::Handle

Inherits:
Object
  • Object
show all
Defined in:
lib/rsvg2/handle.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Handle

Returns a new instance of Handle.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rsvg2/handle.rb', line 32

def initialize(options={})
  flags = options[:flags]
  path = options[:path] || options[:file]
  data = options[:data]

  if path
    if flags
      Gio::File.open(:path => path) do |file|
        initialize_new_from_gfile_sync(file, flags)
      end
    else
      initialize_new_from_file(path)
    end
  elsif data
    initialize_new_from_data(data)
  else
    initialize_raw
  end
end

Class Method Details

.new_from_data(data) ⇒ Object

For backward compatibility



21
22
23
# File 'lib/rsvg2/handle.rb', line 21

def new_from_data(data)
  new(:data => data)
end

.new_from_file(file_name, options = {}) ⇒ Object

For backward compatibility



26
27
28
# File 'lib/rsvg2/handle.rb', line 26

def new_from_file(file_name, options={})
  new(options.merge(:file => file_name))
end

Instance Method Details

#initialize_rawObject



31
# File 'lib/rsvg2/handle.rb', line 31

alias_method :initialize_raw, :initialize