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

Class Method Details

.extend_object(object) ⇒ Object


491
492
493
494
# File 'lib/rabbit/utils.rb', line 491

def extend_object(object)
  super
  LOADERS[object] = []
end

Instance Method Details

#find_loader(*args) ⇒ Object


511
512
513
514
515
# File 'lib/rabbit/utils.rb', line 511

def find_loader(*args)
  loaders.find do |loader|
    loader.match?(*args)
  end
end

#loadersObject


497
498
499
500
501
# File 'lib/rabbit/utils.rb', line 497

def loaders
  LOADERS.find do |loader, value|
    self.ancestors.find {|ancestor| ancestor == loader}
  end[1]
end

#push_loader(loader) ⇒ Object


507
508
509
# File 'lib/rabbit/utils.rb', line 507

def push_loader(loader)
  loaders.push(loader)
end

#unshift_loader(loader) ⇒ Object


503
504
505
# File 'lib/rabbit/utils.rb', line 503

def unshift_loader(loader)
  loaders.unshift(loader)
end