Module: Coach4rb::Mixin::Iterable::InstanceMethods

Defined in:
lib/coach4rb/mixin/iterable.rb

Instance Method Summary collapse

Instance Method Details

#has_next?Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/coach4rb/mixin/iterable.rb', line 13

def has_next?
  link = self.next
  link ? link[:href] : false
end

#has_previous?Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/coach4rb/mixin/iterable.rb', line 24

def has_previous?
  link = previous
  link ? link[:href] : false
end

#nextObject



19
20
21
# File 'lib/coach4rb/mixin/iterable.rb', line 19

def next
  links.detect { |link| link[:description] == 'next'}
end

#previousObject



30
31
32
# File 'lib/coach4rb/mixin/iterable.rb', line 30

def previous
  links.detect { |link| link[:description] == 'previous'}
end