Class: Serializable::Versions
- Inherits:
-
Array
- Object
- Array
- Serializable::Versions
- Defined in:
- lib/serializable/versions.rb
Instance Method Summary collapse
Instance Method Details
#<<(object) ⇒ Object
6 7 8 9 |
# File 'lib/serializable/versions.rb', line 6 def <<(object) super(object) self.sort! end |
#find_version(seeking_version) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/serializable/versions.rb', line 16 def find_version(seeking_version) previous_version = nil if seeking_version.is_a?(Version) self.each do |version| if version < seeking_version previous_version = version elsif version > seeking_version return previous_version else return version end end end previous_version end |
#push(object) ⇒ Object
11 12 13 14 |
# File 'lib/serializable/versions.rb', line 11 def push(object) super(object) self.sort! end |