lib/sinatra/export.rb
def build!(&block)
        dir = Pathname( ENV["EXPORT_BUILD_DIR"] || app.public_folder )
        handle_error_dir_not_found!(dir) unless dir.exist? && dir.directory?

        if @use_routes
          @enums.push self.send(:route_paths).to_enum
        end
        @enums.push @paths.to_enum

        catch(:no_more_paths) do
          enum = @enums.shift
          while true
            begin
              @last_path, status = enum.next
              @last_path = @last_path.respond_to?(:path) ?
                            @last_path.path :
                            @last_path.to_s
              next unless route_path_usable?(@last_path)
              next if @skips.include? @last_path
              @last_path = @last_path.chop if @last_path.end_with? "?"
              desc = catch(:status_error) {
                @last_response = get_path(@last_path, status)
                block.call self if block
                file_path = build_path(path: @last_path, dir: dir, response: last_response)
                nil
              }
              desc ?
                @errored |= [@last_path] :
                @visited |= [@last_path]
            rescue StopIteration
              retry if enum = @enums.shift
              throw(:no_more_paths)
            end
          end
        end
        self
      end
# Processes the routes and builds the output files.
# @yield [builder] Gives a Builder instance to the block (see Builder) that is called for every path visited.
# @return [self]
Processes the routes and builds the output files.
Processes the routes and builds the output files .
def build!(&block)
        dir = Pathname( ENV["EXPORT_BUILD_DIR"] || app.public_folder )
        handle_error_dir_not_found!(dir) unless dir.exist? && dir.directory?
        if @use_routes
          @enums.push self.send(:route_paths).to_enum
        end
        @enums.push @paths.to_enum
        catch(:no_more_paths) do
          enum = @enums.shift
          while true
            begin
              @last_path, status = enum.next
              @last_path = @last_path.respond_to?(:path) ?
                            @last_path.path :
                            @last_path.to_s
              next unless route_path_usable?(@last_path)
              next if @skips.include? @last_path
              @last_path = @last_path.chop if @last_path.end_with? "?"
              desc = catch(:status_error) {
                @last_response = get_path(@last_path, status)
                block.call self if block
                file_path = build_path(path: @last_path, dir: dir, response: last_response)
                nil
              }
              desc ?
                @errored |= [@last_path] :
                @visited |= [@last_path]
            rescue StopIteration
              retry if enum = @enums.shift
              throw(:no_more_paths)
            end
          end
        end
        self
      end
def build! ( & block ) dir = Pathname ( ENV [ "EXPORT_BUILD_DIR" ] || app . public_folder ) handle_error_dir_not_found! ( dir ) unless dir . exist? && dir . directory? if @use_routes @enums . push self . send ( :route_paths ) . to_enum end @enums . push @paths . to_enum catch ( :no_more_paths ) do enum = @enums . shift while true begin @last_path , status = enum . next @last_path = @last_path . respond_to? ( :path ) ? @last_path . path : @last_path . to_s next unless route_path_usable? ( @last_path ) next if @skips . include? @last_path @last_path = @last_path . chop if @last_path . end_with? "?" desc = catch ( :status_error ) { @last_response = get_path ( @last_path , status ) block . call self if block file_path = build_path ( path : @last_path , dir : dir , response : last_response ) nil } desc ? @errored |= [ @last_path ] : @visited |= [ @last_path ] rescue StopIteration retry if enum = @enums . shift throw ( :no_more_paths ) end end end self end
Processes the routes and builds the output files.
Processes the routes and builds the output files .
None
self
block
]
Gives a Builder instance to the block  that is called for every path visited.
Gives a Builder instance to the block that is called for every path visited .