Module: Lexorank::Rankable::InstanceMethods

Defined in:
lib/lexorank/rankable.rb

Instance Method Summary collapse

Instance Method Details

#move_toObject



33
34
35
# File 'lib/lexorank/rankable.rb', line 33

def move_to(...)
  self.class.lexorank_ranking.move_to(self, ...)
end

#move_to!(position, **options) ⇒ Object



37
38
39
40
41
# File 'lib/lexorank/rankable.rb', line 37

def move_to!(position, **options)
  move_to(position, **options) do
    save
  end
end

#move_to_endObject



29
30
31
# File 'lib/lexorank/rankable.rb', line 29

def move_to_end(...)
  self.class.lexorank_ranking.move_to(self, :last, ...)
end

#move_to_end!(**options) ⇒ Object



49
50
51
52
53
# File 'lib/lexorank/rankable.rb', line 49

def move_to_end!(**options)
  move_to_end(**options) do
    save
  end
end

#move_to_topObject



25
26
27
# File 'lib/lexorank/rankable.rb', line 25

def move_to_top(...)
  move_to(0, ...)
end

#move_to_top!(**options) ⇒ Object



43
44
45
46
47
# File 'lib/lexorank/rankable.rb', line 43

def move_to_top!(**options)
  move_to_top(**options) do
    save
  end
end

#no_rank?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/lexorank/rankable.rb', line 55

def no_rank?
  !send(self.class.lexorank_ranking.field)
end