Class: Bio::Graphics::ImageMap::Element

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) ⇒ Element

Returns a new instance of Element.



44
45
46
47
# File 'lib/bio/graphics/image_map.rb', line 44

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.



48
49
50
# File 'lib/bio/graphics/image_map.rb', line 48

def bottom
  @bottom
end

#leftObject

Returns the value of attribute left.



48
49
50
# File 'lib/bio/graphics/image_map.rb', line 48

def left
  @left
end

#rightObject

Returns the value of attribute right.



48
49
50
# File 'lib/bio/graphics/image_map.rb', line 48

def right
  @right
end

#topObject

Returns the value of attribute top.



48
49
50
# File 'lib/bio/graphics/image_map.rb', line 48

def top
  @top
end

#urlObject

Returns the value of attribute url.



48
49
50
# File 'lib/bio/graphics/image_map.rb', line 48

def url
  @url
end

Instance Method Details

#to_sObject



50
51
52
53
54
55
56
# File 'lib/bio/graphics/image_map.rb', line 50

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