Sha256: a7598ca738cfefb860c4a00458db7faeb18bcb739921bd2aef060df5c6c5157b

Contents?: true

Size: 513 Bytes

Versions: 7

Compression:

Stored size: 513 Bytes

Contents

require 'fileutils'

module ActiveAssets
  module ActiveSprites
    class SpriteStylesheet
      def initialize(sprite_path, sprite_pieces)
        @sprite_path, @sprite_pieces = sprite_path, 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

7 entries across 7 versions & 1 rubygems

Version Path
active_assets-0.2.2 lib/active_assets/active_sprites/sprite_stylesheet.rb
active_assets-0.2.1 lib/active_assets/active_sprites/sprite_stylesheet.rb
active_assets-0.2.0 lib/active_assets/active_sprites/sprite_stylesheet.rb
active_assets-0.2.0.rc4 lib/active_assets/active_sprites/sprite_stylesheet.rb
active_assets-0.2.0.rc3 lib/active_assets/active_sprites/sprite_stylesheet.rb
active_assets-0.2.0.rc2 lib/active_assets/active_sprites/sprite_stylesheet.rb
active_assets-0.2.0.rc lib/active_assets/active_sprites/sprite_stylesheet.rb