class Hanami::Routes::RoutesProc
Wrapper class for the (otherwise opaque) proc returned from {.routes}, adding an ‘#empty?` method that returns true if no routes were defined.
This is useful when needing to determine behaviour based on the presence of user-defined routes, such as determining whether to show the Hanami
welcome page in {Slice#load_router}.
@api private @since 2.1.0
Public Class Methods
empty()
click to toggle source
@api private @since 2.1.0
# File lib/hanami/routes.rb, line 74 def self.empty new(proc {}, empty: true) end
new(proc, empty: false)
click to toggle source
@api private @since 2.1.0
Calls superclass method
# File lib/hanami/routes.rb, line 80 def initialize(proc, empty: false) @empty = empty super(proc) end
Public Instance Methods
empty?()
click to toggle source
@api private @since 2.1.0
# File lib/hanami/routes.rb, line 87 def empty? !!@empty end