Module: Padrino::Reloader::Storage

### Home Classes Methods

### In Files

- lib/padrino-core/reloader/storage.rb

### Methods

- #clear!
- #commit
- #prepare
- #remove
- #rollback

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Application
- Padrino::ApplicationLoadError
- Padrino::ApplicationSetup
- Padrino::ApplicationSetup::ClassMethods
- Padrino::AuthenticityToken
- Padrino::Cli
- Padrino::Cli::Adapter
- Padrino::Cli::Base
- Padrino::Cli::Launcher
- Padrino::Filter
- Padrino::Flash
- Padrino::Flash::Helpers
- Padrino::Flash::Storage
- Padrino::Loader
- Padrino::Logger
- Padrino::Logger::Colorize
- Padrino::Logger::Extensions
- Padrino::Logger::Rack
- Padrino::Module
- Padrino::Mounter
- Padrino::Mounter::ApplicationWrapper
- Padrino::Mounter::MounterException
- Padrino::ParamsProtection
- Padrino::ParamsProtection::ClassMethods
- Padrino::ParamsProtection::InstanceMethods
- Padrino::Reloader
- Padrino::Reloader::Rack
- Padrino::Reloader::Storage
- Padrino::Router
- Padrino::Routing
- Padrino::Routing::ClassMethods
- Padrino::Routing::InstanceMethods
- Padrino::Routing::Parent
- Padrino::Routing::UnrecognizedException
- Padrino::Server
- Padrino::ShowExceptions
- Padrino::Tasks
- HttpRouter
- HttpRouter::Node
- HttpRouter::Node::FreeRegex
- HttpRouter::Node::Glob
- HttpRouter::Node::Path
- HttpRouter::Node::SpanningRegex
- HttpRouter::Request
- HttpRouter::Route
- Sinatra
- Sinatra::Base
- Sinatra::Request
- Kernel
- Object
- PadrinoTasks

No matching classes.

# Padrino::Reloader::Storage

### Public Instance Methods

clear!() click to toggle source

    # File lib/padrino-core/reloader/storage.rb, line 6
    def clear!
      files.each_key do |file|
        remove(file)
        Reloader.remove_feature(file)
      end
      @files = {}
    end

commit(name) click to toggle source

    # File lib/padrino-core/reloader/storage.rb, line 33
    def commit(name)
      entry = {
        :constants => ObjectSpace.new_classes(@old_entries[name][:constants]),
        :features  => Set.new($LOADED_FEATURES) - @old_entries[name][:features] - [name]
      }
      files[name] = entry
      @old_entries.delete(name)
    end

prepare(name) click to toggle source

    # File lib/padrino-core/reloader/storage.rb, line 21
    def prepare(name)
      file = remove(name)
      @old_entries ||= {}
      @old_entries[name] = {
        :constants => ObjectSpace.classes,
        :features  => old_features = Set.new($LOADED_FEATURES.dup)
      }
      features = file && file[:features] || []
      features.each{ |feature| Reloader.safe_load(feature, :force => true) }
      Reloader.remove_feature(name) if old_features.include?(name)
    end

remove(name) click to toggle source

    # File lib/padrino-core/reloader/storage.rb, line 14
    def remove(name)
      file = files[name] || return
      file[:constants].each{ |constant| Reloader.remove_constant(constant) }
      file[:features].each{ |feature| Reloader.remove_feature(feature) }
      files.delete(name)
    end

rollback(name) click to toggle source

    # File lib/padrino-core/reloader/storage.rb, line 42
    def rollback(name)
      new_constants = ObjectSpace.new_classes(@old_entries[name][:constants])
      new_constants.each{ |klass| Reloader.remove_constant(klass) }
      @old_entries.delete(name)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.