Module: Rabbit::ModuleLoader
- Included in:
- ImageManipulable::Base, Parser::Base
- Defined in:
- lib/rabbit/utils.rb
Constant Summary collapse
- LOADERS =
{}
Class Method Summary collapse
Instance Method Summary collapse
- #find_loader(*args) ⇒ Object
- #loaders ⇒ Object
- #push_loader(loader) ⇒ Object
- #unshift_loader(loader) ⇒ Object
Class Method Details
.extend_object(object) ⇒ Object
514 515 516 517 |
# File 'lib/rabbit/utils.rb', line 514 def extend_object(object) super LOADERS[object] = [] end |
Instance Method Details
#find_loader(*args) ⇒ Object
534 535 536 537 538 |
# File 'lib/rabbit/utils.rb', line 534 def find_loader(*args) loaders.find do |loader| loader.match?(*args) end end |
#loaders ⇒ Object
520 521 522 523 524 |
# File 'lib/rabbit/utils.rb', line 520 def loaders LOADERS.find do |loader, value| self.ancestors.find {|ancestor| ancestor == loader} end[1] end |
#push_loader(loader) ⇒ Object
530 531 532 |
# File 'lib/rabbit/utils.rb', line 530 def push_loader(loader) loaders.push(loader) end |
#unshift_loader(loader) ⇒ Object
526 527 528 |
# File 'lib/rabbit/utils.rb', line 526 def unshift_loader(loader) loaders.unshift(loader) end |