Class: RQRCodeSVG::Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/rqrcode_svg/sequence.rb

Instance Method Summary collapse

Constructor Details

#initialize(qr_code) ⇒ Sequence

Returns a new instance of Sequence.



3
4
5
# File 'lib/rqrcode_svg/sequence.rb', line 3

def initialize(qr_code)
  @qr_code = qr_code
end

Instance Method Details

#dark_squares_only(&block) ⇒ Object

This method yields the vertices of the dark squares



8
9
10
11
12
13
14
15
16
# File 'lib/rqrcode_svg/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