Module: RemoteResource::BaseClassMethods
- Included in:
- Base
- Defined in:
- lib/remote_resource/base/base_class_methods.rb
Overview
Methods that help with loading and naming the Base class.
Instance Method Summary collapse
- #ensure_loaded(which_class) ⇒ Object
- #find_descendant(which_class) ⇒ Object
- #symbol_name ⇒ Object
- #underscore ⇒ Object
Instance Method Details
#ensure_loaded(which_class) ⇒ Object
11 12 13 |
# File 'lib/remote_resource/base/base_class_methods.rb', line 11 def ensure_loaded(which_class) which_class.to_s.camelize.safe_constantize end |
#find_descendant(which_class) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/remote_resource/base/base_class_methods.rb', line 4 def find_descendant(which_class) ensure_loaded(which_class) descendants.detect do |descendant| descendant.symbol_name == which_class.to_sym end end |
#symbol_name ⇒ Object
19 20 21 |
# File 'lib/remote_resource/base/base_class_methods.rb', line 19 def symbol_name underscore.to_sym end |
#underscore ⇒ Object
15 16 17 |
# File 'lib/remote_resource/base/base_class_methods.rb', line 15 def underscore name.underscore end |