Sha256: 07b6887bd134aeb830c1d778421dbdefc2d1cbb3e96b4ec32b3296cad52464c4

Contents?: true

Size: 686 Bytes

Versions: 16

Compression:

Stored size: 686 Bytes

Contents

module HtmlEmailCreator
  
  module Helper
    
    class << self
      
      # Find recursively starting from start_from_dir and continues towards a root.
      def find_recursively(start_from_dir, dir_or_file, default_if_not_found = nil)
        current_file = File.join(start_from_dir, dir_or_file)
        if File.exists?(current_file)
          current_file
        else
          next_file = File.dirname(start_from_dir)
          if start_from_dir == next_file
            return default_if_not_found
          end
        
          # continue searching
          find_recursively(next_file, dir_or_file, default_if_not_found)
        end
      end
      
    end    
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
html_email_creator-1.0.18 lib/html_email_creator/helper.rb
html_email_creator-1.0.16 lib/html_email_creator/helper.rb
html_email_creator-1.0.15 lib/html_email_creator/helper.rb
html_email_creator-1.0.14 lib/html_email_creator/helper.rb
html_email_creator-1.0.13 lib/html_email_creator/helper.rb
html_email_creator-1.0.10 lib/html_email_creator/helper.rb
html_email_creator-1.0.9 lib/html_email_creator/helper.rb
html_email_creator-1.0.8 lib/html_email_creator/helper.rb
html_email_creator-1.0.7 lib/html_email_creator/helper.rb
html_email_creator-1.0.6 lib/html_email_creator/helper.rb
html_email_creator-1.0.5 lib/html_email_creator/helper.rb
html_email_creator-1.0.4 lib/html_email_creator/helper.rb
html_email_creator-1.0.3 lib/html_email_creator/helper.rb
html_email_creator-1.0.2 lib/html_email_creator/helper.rb
html_email_creator-1.0.1 lib/html_email_creator/helper.rb
html_email_creator-1.0.0 lib/html_email_creator/helper.rb