File: paths.rb

package info (click to toggle)
ruby-compass 1.0.3~dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,184 kB
  • ctags: 1,789
  • sloc: ruby: 12,904; makefile: 100; perl: 43; xml: 14; sh: 4
file content (19 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Compass::Configuration::Paths

  TRAILING_SEPARATOR = %r{.(/|#{Regexp.escape(File::SEPARATOR)})$}

  def strip_trailing_separator(*attributes)
    attributes.each do |attr|
      alias_method "#{attr}_with_trailing_separator".to_sym, attr
      class_eval %Q{
        def #{attr}                                # def css_dir
          path = #{attr}_with_trailing_separator   #   path = css_dir_with_trailing_separator
          if path.to_s =~ TRAILING_SEPARATOR       #   if path =~ TRAILING_SEPARATOR
            path = path[0..-($1.length+1)]         #     path = path[0..-($1.length+1)]
          end                                      #   end
          path                                     #   path
        end                                        # end
      }
    end
  end
end