Sha256: 6fbc36106d5b11909394630391c33178881d5da237273e586259d43575c087aa

Contents?: true

Size: 882 Bytes

Versions: 15

Compression:

Stored size: 882 Bytes

Contents

module Sprite
  class ImageConfig
    def initialize(image_info, global_config_info)
      @image_info = image_info
      @global_config_info = global_config_info
    end

    def sources
      @image_info['sources'].to_a
    end

    def name
      @image_info['name']
    end

    def format
      @image_info['format'] || @global_config_info["default_format"]
    end

    def quality
      @image_info['quality'] || @global_config_info["default_quality"]
    end

    def background_color
      @image_info['background_color'] || @global_config_info["default_background_color"]
    end

    def spaced_by
      @image_info['spaced_by'] || @global_config_info["default_spacing"] || 0
    end

    def resize_to
      @image_info['resize_to'] || @global_config_info['resize_to']
    end

    def horizontal_layout?
      @image_info['align'].to_s == 'horizontal'
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
sprite-0.3.0 lib/sprite/image_config.rb
sprite-0.2.7 lib/sprite/image_config.rb
amikula-sprite-0.1.13 lib/sprite/image_config.rb
sprite-0.2.6 lib/sprite/image_config.rb
amikula-sprite-0.1.12 lib/sprite/image_config.rb
sprite-0.2.5 lib/sprite/image_config.rb
sprite-0.2.4 lib/sprite/image_config.rb
sprite-0.2.2 lib/sprite/image_config.rb
sprite-0.2.1 lib/sprite/image_config.rb
sprite-0.2.0 lib/sprite/image_config.rb
amikula-sprite-0.1.11 lib/sprite/image_config.rb
amikula-sprite-0.1.10 lib/sprite/image_config.rb
amikula-sprite-0.1.9 lib/sprite/image_config.rb
amikula-sprite-0.1.8.1 lib/sprite/image_config.rb
amikula-sprite-0.1.8 lib/sprite/image_config.rb