Class: Middleman::Pagination::IndexPath
- Inherits:
-
Object
- Object
- Middleman::Pagination::IndexPath
- Defined in:
- lib/middleman/pagination/index_path.rb
Instance Attribute Summary collapse
-
#extension_context ⇒ Object
Returns the value of attribute extension_context.
-
#original_path ⇒ Object
Returns the value of attribute original_path.
-
#page_num ⇒ Object
Returns the value of attribute page_num.
-
#symbolic_path_replacement ⇒ Object
Returns the value of attribute symbolic_path_replacement.
Instance Method Summary collapse
-
#initialize(extension_context, original_path, page_num, symbolic_path_replacement = nil) ⇒ IndexPath
constructor
A new instance of IndexPath.
- #to_s ⇒ Object
Constructor Details
#initialize(extension_context, original_path, page_num, symbolic_path_replacement = nil) ⇒ IndexPath
Returns a new instance of IndexPath.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/middleman/pagination/index_path.rb', line 6 def initialize(extension_context, original_path, page_num, symbolic_path_replacement = nil) @extension_context = extension_context @original_path = original_path @symbolic_path_replacement = symbolic_path_replacement || 'pages/:num' if page_num < 1 raise "Expected page_num greater than 0 (page numbers are not zero-indexed" end @page_num = page_num end |
Instance Attribute Details
#extension_context ⇒ Object
Returns the value of attribute extension_context.
4 5 6 |
# File 'lib/middleman/pagination/index_path.rb', line 4 def extension_context @extension_context end |
#original_path ⇒ Object
Returns the value of attribute original_path.
4 5 6 |
# File 'lib/middleman/pagination/index_path.rb', line 4 def original_path @original_path end |
#page_num ⇒ Object
Returns the value of attribute page_num.
4 5 6 |
# File 'lib/middleman/pagination/index_path.rb', line 4 def page_num @page_num end |
#symbolic_path_replacement ⇒ Object
Returns the value of attribute symbolic_path_replacement.
4 5 6 |
# File 'lib/middleman/pagination/index_path.rb', line 4 def symbolic_path_replacement @symbolic_path_replacement end |
Instance Method Details
#to_s ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/middleman/pagination/index_path.rb', line 18 def to_s if first_index? original_path else replaced_path end end |