Class: SimplePaginate::Helpers::Paginator::PageProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_paginate/helpers/paginator.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ PageProxy

Returns a new instance of PageProxy.



32
33
34
# File 'lib/simple_paginate/helpers/paginator.rb', line 32

def initialize(options)
  @options = options
end

Instance Method Details

#+(other) ⇒ Object



56
57
58
# File 'lib/simple_paginate/helpers/paginator.rb', line 56

def +(other)
  to_i + other.to_i
end

#-(other) ⇒ Object



60
61
62
# File 'lib/simple_paginate/helpers/paginator.rb', line 60

def -(other)
  to_i - other.to_i
end

#<=>(other) ⇒ Object



64
65
66
# File 'lib/simple_paginate/helpers/paginator.rb', line 64

def <=>(other)
  to_i <=> other.to_i
end

#first?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/simple_paginate/helpers/paginator.rb', line 40

def first?
  @options[:current_page] == 1
end

#last?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/simple_paginate/helpers/paginator.rb', line 44

def last?
  @options[:length] < @options[:per_page]
end

#numberObject



36
37
38
# File 'lib/simple_paginate/helpers/paginator.rb', line 36

def number
  @options[:current_page]
end

#to_iObject



48
49
50
# File 'lib/simple_paginate/helpers/paginator.rb', line 48

def to_i
  number
end

#to_sObject



52
53
54
# File 'lib/simple_paginate/helpers/paginator.rb', line 52

def to_s
  number.to_s
end