Class: Squib::Sprues::CropLine
- Inherits:
-
Object
- Object
- Squib::Sprues::CropLine
- Defined in:
- lib/squib/sprues/crop_line.rb
Instance Attribute Summary collapse
- #x1 ⇒ Object readonly
- #x2 ⇒ Object readonly
- #y1 ⇒ Object readonly
- #y2 ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(type, position, sheet_width, sheet_height, dpi) ⇒ CropLine
constructor
A new instance of CropLine.
- #parse_horizontal(position, sheet_width, _, dpi) ⇒ Object
- #parse_vertical(position, _, sheet_height, dpi) ⇒ Object
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
#x1 ⇒ Object (readonly)
4 5 6 |
# File 'lib/squib/sprues/crop_line.rb', line 4 def x1 @x1 end |
#x2 ⇒ Object (readonly)
4 5 6 |
# File 'lib/squib/sprues/crop_line.rb', line 4 def x2 @x2 end |
#y1 ⇒ Object (readonly)
4 5 6 |
# File 'lib/squib/sprues/crop_line.rb', line 4 def y1 @y1 end |
#y2 ⇒ Object (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 |