class DotGrid::Pattern

Public Instance Methods

columns() click to toggle source
# File lib/dot_grid/pattern/pattern.rb, line 27
def columns
  (bounds.width / spacing).floor
end
draw() click to toggle source
# File lib/dot_grid/pattern/dot_grid.rb, line 12
def draw
  pdf.fill_color grid_color
  draw_grid do |row, column|
    pdf.fill_circle [column*spacing, row*spacing], dot_weight
  end
end
draw_grid(shorten = false) { |row, column| ... } click to toggle source
# File lib/dot_grid/pattern/pattern.rb, line 31
def draw_grid(shorten = false)
  pdf.bounding_box(bounds.upper_left, width: bounds.width, height: bounds.height) do
    (0..(shorten ? rows-1 : rows)).each do |row|
      (0..(shorten ? columns-1 : columns)).each do |column|
        yield row, column
      end
    end
  end
end
post_initialize(params) click to toggle source
# File lib/dot_grid/pattern/pattern.rb, line 19
def post_initialize(params)
  nil
end
rows() click to toggle source
# File lib/dot_grid/pattern/pattern.rb, line 23
def rows
  (bounds.height / spacing).floor
end