Module: Broadway::Sortable::InstanceMethods
- Defined in:
- lib/broadway/mixins/sortable.rb
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Spaceship is based on Post#date, slug.
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
8 9 10 |
# File 'lib/broadway/mixins/sortable.rb', line 8 def position @position end |
Instance Method Details
#<=>(other) ⇒ Object
Spaceship is based on Post#date, slug
Returns -1, 0, 1
13 14 15 16 17 18 19 20 21 |
# File 'lib/broadway/mixins/sortable.rb', line 13 def <=>(other) if self.date and other.date other.date <=> self.date elsif self.position and other.position self.position <=> other.position else 0 end end |