Class: RQREncoder::QRCode

Inherits:
Object
  • Object
show all
Defined in:
lib/rqrencoder-magick/qrcode_ext.rb

Constant Summary collapse

@@default_render_options =
{:module_pixels => 10, :margin => 4, :fill_color => 'black', :background_color => 'white'}

Instance Method Summary collapse

Instance Method Details

#draw(render_options = {}) ⇒ Object



11
12
13
# File 'lib/rqrencoder-magick/qrcode_ext.rb', line 11

def draw(render_options = {})
	render_rvg(@@default_render_options.merge(render_options)).draw
end

#draw_svg(render_options = {}) ⇒ Object

imagemagick’s svg output is messed up



20
21
22
# File 'lib/rqrencoder-magick/qrcode_ext.rb', line 20

def draw_svg(render_options = {})
	render_svg(@@default_render_options.merge(render_options))
end

#save(filename, render_options = {}) ⇒ Object



15
16
17
# File 'lib/rqrencoder-magick/qrcode_ext.rb', line 15

def save(filename, render_options = {})
	draw(render_options).write(filename)
end

#save_svg(filename, render_options = {}) ⇒ Object



24
25
26
27
28
# File 'lib/rqrencoder-magick/qrcode_ext.rb', line 24

def save_svg(filename, render_options = {})
	file = File.new(filename, "w")
	file.puts(draw_svg(render_options))
	file.close
end