Class: Munge::Routers::RemoveIndexBasename
- Inherits:
-
Object
- Object
- Munge::Routers::RemoveIndexBasename
- Defined in:
- lib/munge/routers/remove_index_basename.rb
Instance Method Summary collapse
- #call(initial_route, _item) ⇒ Object
-
#initialize(html_extensions:, index:) ⇒ RemoveIndexBasename
constructor
A new instance of RemoveIndexBasename.
- #match?(initial_route, item) ⇒ Boolean
- #type ⇒ Object
Constructor Details
#initialize(html_extensions:, index:) ⇒ RemoveIndexBasename
Returns a new instance of RemoveIndexBasename.
4 5 6 7 8 |
# File 'lib/munge/routers/remove_index_basename.rb', line 4 def initialize(html_extensions:, index:) @html_extensions = html_extensions @index = index @index_basename = Munge::Util::Path.basename_no_extension(@index) end |
Instance Method Details
#call(initial_route, _item) ⇒ Object
18 19 20 |
# File 'lib/munge/routers/remove_index_basename.rb', line 18 def call(initial_route, _item) Munge::Util::Path.dirname(initial_route) end |
#match?(initial_route, item) ⇒ Boolean
14 15 16 |
# File 'lib/munge/routers/remove_index_basename.rb', line 14 def match?(initial_route, item) item_is_html?(item) && basename_is_index?(initial_route) end |
#type ⇒ Object
10 11 12 |
# File 'lib/munge/routers/remove_index_basename.rb', line 10 def type :route end |