lib/polymer.rb in polymer-1.0.0.beta.6 vs lib/polymer.rb in polymer-1.0.0.beta.7
- old
+ new
@@ -2,15 +2,19 @@
require 'erb'
require 'pathname'
require 'yaml'
# Gems.
-require 'rmagick'
+begin
+ require 'oily_png' # Load the C version of ChunkyPNG when available.
+rescue LoadError
+ require 'chunky_png' # Fall back to pure-Ruby.
+end
+
# On with the library...
require 'polymer/cache'
-require 'polymer/core_ext'
require 'polymer/css_generator'
require 'polymer/deviant_finder'
require 'polymer/dsl'
require 'polymer/optimisation'
require 'polymer/project'
@@ -44,6 +48,16 @@
# Raised when a sprite defintion doesn't include a name.
MissingName = Class.new(DslError)
# Raised when sprite is defined with a name which has already been used.
DuplicateName = Class.new(DslError)
+
+ # A utility method; given a string, removes leading and trailing whitespace
+ # from each line, then joins all the lines into one.
+ #
+ # @param [String] str A string
+ # @return [String]
+ #
+ def self.compress_lines(str)
+ str.split($/).map { |line| line.strip }.join(' ')
+ end
end