Sha256: 3f693ee684c404ef8d8cdd180cd0fefbcdfe9ecdc9b69b27ccc05fe0e559caa0

Contents?: true

Size: 736 Bytes

Versions: 17

Compression:

Stored size: 736 Bytes

Contents

module Arrest
  class ScopedRoot
    attr_accessor :context

    def initialize(context = Arrest::RequestContext.new())
      @context = context
    end

    def self.register_resource(clazz)
      @classes ||= {}
      @classes[clazz] = true
      class_name = ClassUtils.simple_name(clazz)
      send :define_method, class_name do ||
        clazz.mk_proxy(self)
      end
    end

    def self.registered_classes
      @classes ||= {}
      @classes.keys
    end

    def delete_all
      self.class.registered_classes.each do |clazz|
        begin
          clazz.delete_all(@context)
        rescue
          puts "couldnt delete #{clazz.name}s"
        end
      end
    end

    def get_context
      @context
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
arrest-0.0.91 lib/arrest/transport/scoped_root.rb
arrest-0.0.90 lib/arrest/transport/scoped_root.rb
arrest-0.0.89 lib/arrest/transport/scoped_root.rb
arrest-0.0.88 lib/arrest/transport/scoped_root.rb
arrest-0.0.87 lib/arrest/transport/scoped_root.rb
arrest-0.0.86 lib/arrest/transport/scoped_root.rb
arrest-0.0.85 lib/arrest/transport/scoped_root.rb
arrest-0.0.84 lib/arrest/transport/scoped_root.rb
arrest-0.0.83.crud lib/arrest/transport/scoped_root.rb
arrest-0.0.83.1 lib/arrest/transport/scoped_root.rb
arrest-0.0.83 lib/arrest/transport/scoped_root.rb
arrest-0.0.82 lib/arrest/transport/scoped_root.rb
arrest-0.0.80 lib/arrest/transport/scoped_root.rb
arrest-0.0.79 lib/arrest/transport/scoped_root.rb
arrest-0.0.78 lib/arrest/transport/scoped_root.rb
arrest-0.0.77 lib/arrest/transport/scoped_root.rb
arrest-0.0.76 lib/arrest/transport/scoped_root.rb