Sha256: 9c9f0150461b33587635aaba480c3bf8230b4d59f0f5e65c8a0ca4ef4edecd79

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

require 'fileutils'

module ActiveAssets
  module ActiveSprites
    class SpriteStylesheet
      def initialize(sprite_pieces)
        @sprite_pieces = sprite_pieces
      end

      def write(path)
        to_s!
        FileUtils.mkdir_p(File.dirname(path))
        File.open(path, 'w+') do |f|
          f.write @as_string
        end
      end

      private
        def to_s!
          @as_string ||= @sprite_pieces.map(&:to_s).join("\n")
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_assets-0.2.3 lib/active_assets/active_sprites/sprite_stylesheet.rb