Module: Genghis::ProxyMethods::ClassMethods
- Defined in:
- lib/genghis.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
187
188
189
190
191
|
# File 'lib/genghis.rb', line 187
def method_missing(method, * args, & block)
protect_from_exception do
Guardian.make_safe(@protected_class.__send__(method, * args, & block))
end
end
|
Instance Attribute Details
#protected_class ⇒ Object
Returns the value of attribute protected_class.
171
172
173
|
# File 'lib/genghis.rb', line 171
def protected_class
@protected_class
end
|
Instance Method Details
#allocate ⇒ Object
193
194
195
|
# File 'lib/genghis.rb', line 193
def allocate
@protected_class.allocate
end
|
#fix_broken_connection ⇒ Object
223
224
225
226
227
228
229
|
# File 'lib/genghis.rb', line 223
def fix_broken_connection
Genghis.reconnect
if defined?(MongoMapper)
MongoMapper.connection = Genghis.connection
MongoMapper.database = Genghis.databases['mongo_mapper']
end
end
|
#protect_from_exception(&block) ⇒ Object
#protected?(clazz) ⇒ Boolean
183
184
185
|
# File 'lib/genghis.rb', line 183
def protected?(clazz)
@@protected_classes.include? clazz
end
|
#protects(clazz) ⇒ Object
#safe? ⇒ Boolean
197
198
199
|
# File 'lib/genghis.rb', line 197
def safe?
true
end
|