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

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

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) has_next?

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

- (Boolean) has_previous?

Returns:

  • (Boolean)


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

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

- (Object) next



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

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

- (Object) previous



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

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