Class: Squib::Sprues::CropLine

Inherits:
Object
  • Object
show all
Defined in:
lib/squib/sprues/crop_line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, position, sheet_width, sheet_height, dpi) ⇒ CropLine

Returns a new instance of CropLine



6
7
8
9
# File 'lib/squib/sprues/crop_line.rb', line 6

def initialize(type, position, sheet_width, sheet_height, dpi)
  method = "parse_#{type}"
  send method, position, sheet_width, sheet_height, dpi
end

Instance Attribute Details

#x1Object (readonly)



4
5
6
# File 'lib/squib/sprues/crop_line.rb', line 4

def x1
  @x1
end

#x2Object (readonly)



4
5
6
# File 'lib/squib/sprues/crop_line.rb', line 4

def x2
  @x2
end

#y1Object (readonly)



4
5
6
# File 'lib/squib/sprues/crop_line.rb', line 4

def y1
  @y1
end

#y2Object (readonly)



4
5
6
# File 'lib/squib/sprues/crop_line.rb', line 4

def y2
  @y2
end

Instance Method Details

#parse_horizontal(position, sheet_width, _, dpi) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/squib/sprues/crop_line.rb', line 11

def parse_horizontal(position, sheet_width, _, dpi)
  position = Args::UnitConversion.parse(position, dpi)
  @x1 = 0
  @y1 = position
  @x2 = sheet_width
  @y2 = position
end

#parse_vertical(position, _, sheet_height, dpi) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/squib/sprues/crop_line.rb', line 19

def parse_vertical(position, _, sheet_height, dpi)
  position = Args::UnitConversion.parse(position, dpi)
  @x1 = position
  @y1 = 0
  @x2 = position
  @y2 = sheet_height
end