Class: Compass::SassExtensions::Sprites::Layout::SpriteLayout

Inherits:
Object
  • Object
show all
Defined in:
lib/compass/sass_extensions/sprites/layout.rb

Direct Known Subclasses

Diagonal, Horizontal, Smart, Vertical

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(images, kwargs = {}) ⇒ SpriteLayout

Returns a new instance of SpriteLayout.



11
12
13
14
15
16
17
18
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 11

def initialize(images, kwargs={})
  @images  = images
  @options = kwargs
  @height  = 0
  @width   = 0
  
  layout!
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



9
10
11
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 9

def height
  @height
end

#imagesObject (readonly)

Returns the value of attribute images.



8
9
10
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 8

def images
  @images
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 8

def options
  @options
end

#widthObject

Returns the value of attribute width.



9
10
11
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 9

def width
  @width
end

Instance Method Details

#layout!Object



20
21
22
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 20

def layout!
  raise Compass::SpriteException, "You must impliment layout!"
end

#propertiesObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/compass/sass_extensions/sprites/layout.rb', line 24

def properties
  if @width.zero?
    raise Compass::SpriteException, "You must set the width fetching the properties"
  end
  if @height.zero?
    raise Compass::SpriteException, "You must set the height fetching the properties"
  end

  [@images, @width, @height]
end