Class: Versionable::Version::Crop
- Inherits:
-
Object
- Object
- Versionable::Version::Crop
- Defined in:
- lib/versionable/version.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x1, y1, x2, y2) ⇒ Crop
constructor
A new instance of Crop.
- #to_str ⇒ Object (also: #to_s)
Constructor Details
#initialize(x1, y1, x2, y2) ⇒ Crop
Returns a new instance of Crop.
159 160 161 |
# File 'lib/versionable/version.rb', line 159 def initialize(x1, y1, x2, y2) @x1, @y1, @x2, @y2 = x1, y1, x2, y2 end |
Class Method Details
.create! ⇒ Object
155 156 157 |
# File 'lib/versionable/version.rb', line 155 def self.create! new(@x1, @y1, @x2, @y2) end |
.from(hash) ⇒ Object
143 144 145 146 147 |
# File 'lib/versionable/version.rb', line 143 def self.from(hash) @x1 = hash[:x] @y1 = hash[:y] self end |
.to(hash) ⇒ Object
149 150 151 152 153 |
# File 'lib/versionable/version.rb', line 149 def self.to(hash) @x2 = hash[:x] @y2 = hash[:y] self end |
Instance Method Details
#to_str ⇒ Object Also known as: to_s
163 164 165 |
# File 'lib/versionable/version.rb', line 163 def to_str "#{@x1}x#{@y1}:#{@x2}x#{@y2}" end |