Class: Arrest::ScopedRoot
- Inherits:
-
Object
- Object
- Arrest::ScopedRoot
- Defined in:
- lib/arrest/transport/scoped_root.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
- #delete_all ⇒ Object
- #get_context ⇒ Object
-
#initialize(context = Arrest::RequestContext.new()) ⇒ ScopedRoot
constructor
A new instance of ScopedRoot.
Constructor Details
#initialize(context = Arrest::RequestContext.new()) ⇒ ScopedRoot
Returns a new instance of ScopedRoot.
5 6 7 |
# File 'lib/arrest/transport/scoped_root.rb', line 5 def initialize(context = Arrest::RequestContext.new()) @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
3 4 5 |
# File 'lib/arrest/transport/scoped_root.rb', line 3 def context @context end |
Class Method Details
.register_resource(clazz) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/arrest/transport/scoped_root.rb', line 9 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 |
.registered_classes ⇒ Object
18 19 20 21 |
# File 'lib/arrest/transport/scoped_root.rb', line 18 def self.registered_classes @classes ||= {} @classes.keys end |
Instance Method Details
#delete_all ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/arrest/transport/scoped_root.rb', line 23 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 |
#get_context ⇒ Object
33 34 35 |
# File 'lib/arrest/transport/scoped_root.rb', line 33 def get_context @context end |