Class: Cocoslicer::Rect
- Inherits:
-
Object
- Object
- Cocoslicer::Rect
- Defined in:
- lib/cocoslicer.rb
Instance Attribute Summary collapse
-
#orig ⇒ Object
Returns the value of attribute orig.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #import_from_str(str) ⇒ Object
-
#initialize(orig_point = Point.new, size = Size.new) ⇒ Rect
constructor
A new instance of Rect.
- #to_cmd_str(rotated) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#orig ⇒ Object
Returns the value of attribute orig.
66 67 68 |
# File 'lib/cocoslicer.rb', line 66 def orig @orig end |
#size ⇒ Object
Returns the value of attribute size.
66 67 68 |
# File 'lib/cocoslicer.rb', line 66 def size @size end |
Instance Method Details
#import_from_str(str) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/cocoslicer.rb', line 74 def import_from_str(str) match = @@re.match(str) @orig = Point.new( match[1].to_i, match[2].to_i ) @size = Size.new( match[3].to_i, match[4].to_i ) return self end |
#to_cmd_str(rotated) ⇒ Object
82 83 84 |
# File 'lib/cocoslicer.rb', line 82 def to_cmd_str(rotated) return @size.to_cmd_str(rotated) + @orig.to_cmd_str end |
#to_s ⇒ Object
86 87 88 |
# File 'lib/cocoslicer.rb', line 86 def to_s return "{orig=#{@orig},size=#{@size}}" end |