Class: DotGrid::Pattern::DotDash

Inherits:
Pattern
  • Object
show all
Defined in:
lib/dot_grid/pattern/dot_dash.rb

Constant Summary collapse

POST_DOT_SPACING =
0.2
TO_LENGTH =
1.0 - POST_DOT_SPACING

Instance Attribute Summary

Attributes inherited from Pattern

#bounds, #grid_color, #pdf

Instance Method Summary collapse

Methods inherited from Pattern

#columns, #draw_grid, #initialize, #rows

Constructor Details

This class inherits a constructor from DotGrid::Pattern::Pattern

Instance Method Details

#drawObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/dot_grid/pattern/dot_dash.rb', line 15

def draw
  pdf.line_width @dot_weight
  pdf.fill_color grid_color
  pdf.stroke_color grid_color
  draw_grid do |row, column|
    pdf.fill_circle [column*spacing, row*spacing], dot_weight
    pdf.stroke_horizontal_line(column*spacing+POST_DOT_SPACING*spacing, column*spacing+spacing*TO_LENGTH, :at => row*spacing) 
    pdf.stroke_vertical_line(row*spacing+POST_DOT_SPACING*spacing, row*spacing+spacing*TO_LENGTH, :at => column*spacing) 
  end
end

#post_initialize(params) ⇒ Object



11
12
13
# File 'lib/dot_grid/pattern/dot_dash.rb', line 11

def post_initialize(params)
  @dot_weight = params[:dot_weight] || 1.5
end