Sha256: 4ad27da97883e64046cf041c592b4adf8f690e208b876588126003068d095738

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

require 'find'

module ExtensibleObjectHelper 
  
  def self.append_features(base) # :nodoc:
    super
    base.extend ClassMethods
  end
  
  module ClassMethods

    def handle_extensions      
      /^(#{BRISKBILLS_ROOT}.+)\.rb\:[\d]+/.match caller[0]
      
      extension_directory = $1
      
      Find.find(extension_directory) do |f| 
        # Don't traverse sub-directories:
        Find.prune if f != extension_directory and File.directory?(f)

        require_dependency f if /#{extension_directory}\/.+\.rb$/.match f 
      end if File.directory? extension_directory
      
    end    

  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brisk-bills-0.8.2 app/helpers/extensible_object_helper.rb
brisk-bills-0.8.1 app/helpers/extensible_object_helper.rb
brisk-bills-0.7.0 app/helpers/extensible_object_helper.rb
brisk-bills-0.6.0 app/helpers/extensible_object_helper.rb