Class: WhirledPeas::Graphics::ContentDimensions

Inherits:
Object
  • Object
show all
Defined in:
lib/whirled_peas/graphics/content_dimensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings, content) ⇒ ContentDimensions

Returns a new instance of ContentDimensions.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/whirled_peas/graphics/content_dimensions.rb', line 6

def initialize(settings, content)
  if settings.width
    @outer_width = settings.width
  else
    @outer_width = 0
    content.each do |line|
      @outer_width = line.length if line.length > @outer_width
    end
  end
  @outer_height = settings.height || content.length
end

Instance Attribute Details

#outer_heightObject (readonly)

Returns the value of attribute outer_height.



4
5
6
# File 'lib/whirled_peas/graphics/content_dimensions.rb', line 4

def outer_height
  @outer_height
end

#outer_widthObject (readonly)

Returns the value of attribute outer_width.



4
5
6
# File 'lib/whirled_peas/graphics/content_dimensions.rb', line 4

def outer_width
  @outer_width
end