class RQRCodePNG::Sequence
Public Class Methods
new(qr_code)
click to toggle source
# File lib/rqrcode_png/sequence.rb, line 3 def initialize(qr_code) @qr_code = qr_code end
Public Instance Methods
border_width()
click to toggle source
Returns the border, 1/10 of the img size
# File lib/rqrcode_png/sequence.rb, line 24 def border_width() @border ||= img_size() / 10 end
dark_squares_only() { |row, column| ... }
click to toggle source
This method yields the vertices of the dark squares
# File lib/rqrcode_png/sequence.rb, line 8 def dark_squares_only(&block) @qr_code.modules.each_index do |row| @qr_code.modules.each_index do |column| if @qr_code.dark?(row, column) yield row, column end end end end
img_size()
click to toggle source
returns the image size by looking at how long the first line of the code is
# File lib/rqrcode_png/sequence.rb, line 19 def img_size @img_size ||= @qr_code.to_s.split("\n").first.size() end