Sha256: faf68580dd497cf400b1d0fc02bf249a878659f656e98836a3a5a793dfdee89c

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

module Bio
  class Graphics
#The Primitive class is used to hold information about Glyphs.
#They contain a Glyph type and then a Hash of parameters pertinent for that Glyph
class Primitive
  attr_reader :primitive
  #Creates a new Primitive and initialises the Hash keys into instance variables
  #
  #+args+
  #* primitive = the Primitive type
  #* args = a hash of parameters needed to initialise the given Glyph type
  def initialize(primitive,args)
    @primitive = primitive
    args.each_key do |k|
      self.instance_variable_set("@#{k}", args[k])
    end 
  end

  #Updates a Primitive and initialises any new parameters into instance variables
  #
  #+args+
  #* args = a hash of new parameters for the given Glyph type
  def update(args)
    args.each_key do |k|
      self.instance_variable_set("@#{k}", args[k])
    end
  end
  
end

end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bio-svgenes-0.3.1 lib/bio/graphics/primitive.rb