Class: Bioroebe::SVG::Primitive
- Inherits:
-
Object
- Object
- Bioroebe::SVG::Primitive
- Defined in:
- lib/bioroebe/svg/primitive.rb
Overview
Bioroebe::SVG::Primitive
Instance Method Summary collapse
-
#initialize(primitive, args) ⇒ Primitive
constructor
# === initialize Creates a new Primitive and initializes the instance variables dynamically from the arguments Hash called args.
-
#primitive? ⇒ Boolean
(also: #primitive)
# === primitive? ========================================================================= #.
-
#update(args) ⇒ Object
# === update.
Constructor Details
#initialize(primitive, args) ⇒ Primitive
#
initialize
Creates a new Primitive and initializes the instance variables dynamically from the arguments Hash called args.
Arguments (2):
:primitive = the Primitive type
args = a hash of parameters needed to describe the attributes
of the primitive type.
#
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bioroebe/svg/primitive.rb', line 35 def initialize( primitive, args ) @primitive = primitive # ======================================================================= # # Iterate over our Hash next. # ======================================================================= # args.each_key { |key| self.instance_variable_set("@#{key}", args[key]) } end |
Instance Method Details
#primitive? ⇒ Boolean Also known as: primitive
#
primitive?
#
66 67 68 |
# File 'lib/bioroebe/svg/primitive.rb', line 66 def primitive? @primitive end |
#update(args) ⇒ Object
#
update
Updates a Primitive and sets the provided values as instance variables.
Arguments:
args = a hash of new parameters for the given primitive type.
#
57 58 59 60 61 |
# File 'lib/bioroebe/svg/primitive.rb', line 57 def update(args) args.each_key { |key| self.instance_variable_set("@#{key}", args[key]) } end |