Class: ImageMap::ImageMapElement

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/graphics/image_map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, top, right, bottom, url = nil) ⇒ ImageMapElement

Returns a new instance of ImageMapElement.



25
26
27
28
# File 'lib/bio/graphics/image_map.rb', line 25

def initialize(left, top, right, bottom, url = nil)
  @left, @top, @right, @bottom = left, top, right, bottom
  @url = ( url.nil? ) ? '' : url
end

Instance Attribute Details

#bottomObject

Returns the value of attribute bottom.



29
30
31
# File 'lib/bio/graphics/image_map.rb', line 29

def bottom
  @bottom
end

#leftObject

Returns the value of attribute left.



29
30
31
# File 'lib/bio/graphics/image_map.rb', line 29

def left
  @left
end

#rightObject

Returns the value of attribute right.



29
30
31
# File 'lib/bio/graphics/image_map.rb', line 29

def right
  @right
end

#topObject

Returns the value of attribute top.



29
30
31
# File 'lib/bio/graphics/image_map.rb', line 29

def top
  @top
end

#urlObject

Returns the value of attribute url.



29
30
31
# File 'lib/bio/graphics/image_map.rb', line 29

def url
  @url
end

Instance Method Details

#to_sObject



31
32
33
34
35
# File 'lib/bio/graphics/image_map.rb', line 31

def to_s
  unless @url == ''
    return '<area shape="rect" coords="' + @left.to_s + ' ' + @top.to_s + ' ' + @right.to_s + ' ' + @bottom.to_s + '" href="' + @url + '"/>'
  end
end