Class: Margrid::Paginator

Inherits:
Struct
  • Object
show all
Defined in:
lib/margrid/components.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_pageObject

Returns the value of attribute current_page

Returns:

  • (Object)

    the current value of current_page



40
41
42
# File 'lib/margrid/components.rb', line 40

def current_page
  @current_page
end

Class Method Details

.load(data) ⇒ Object



45
46
47
# File 'lib/margrid/components.rb', line 45

def self.load(data)
  new data["page"] if data.key? "page"
end

Instance Method Details

#apply(relation) ⇒ Object



41
42
43
# File 'lib/margrid/components.rb', line 41

def apply(relation)
  relation.page current_page
end

#dumpObject



49
50
51
# File 'lib/margrid/components.rb', line 49

def dump
  {"page" => current_page}
end