From 0efdbd4ebea6f975f3ea6a0188adbbf7f2c74edf Mon Sep 17 00:00:00 2001
From: Matthias Koefferlein
Date: Sun, 26 Nov 2023 10:32:26 +0100
Subject: [PATCH] Doc updates
---
src/db/db/gsiDeclDbTechnologies.cc | 4 +-
src/doc/doc/programming/ruby_binding.xml | 55 ++++++++++++++++++++++++
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/src/db/db/gsiDeclDbTechnologies.cc b/src/db/db/gsiDeclDbTechnologies.cc
index e9d045526..81bc2ca48 100644
--- a/src/db/db/gsiDeclDbTechnologies.cc
+++ b/src/db/db/gsiDeclDbTechnologies.cc
@@ -306,7 +306,7 @@ gsi::Class technology_decl ("db", "Technology",
"specifying its name in \\Layout#technology_name. While \\create_technology already registers "
"the technology, this method allows registering a Technology object that has created in other ways.\n"
"\n"
- "This method returns a reference to the new technology object which is a copy of the argument. "
+ "This method returns a reference to the new technology object, which is a copy of the argument. "
"\\remove_technology can be used to remove a technology registered by this method.\n"
"\n"
"This method has been introduced in version 0.28.14."
@@ -365,7 +365,7 @@ gsi::Class technology_decl ("db", "Technology",
"@code\n"
"tech = RBA::Technology::new\n"
"tech.load(\"mytech.lyt\")\n"
- "RBA::Technology::register(tech)\n"
+ "RBA::Technology::register_technology(tech)\n"
"@/code\n"
"\n"
"Note that in the latter example, an exception will be thrown if a technology with the same "
diff --git a/src/doc/doc/programming/ruby_binding.xml b/src/doc/doc/programming/ruby_binding.xml
index 6ff93b20c..655f395de 100644
--- a/src/doc/doc/programming/ruby_binding.xml
+++ b/src/doc/doc/programming/ruby_binding.xml
@@ -408,6 +408,61 @@ A::new.f(x)
omitted, the default value is used instead.
+ Implicit conversions
+
+ String arguments
+
+
+ If a method expects a string argument, other types are converted to strings
+ using the "to_s" method. In Python, the equivalent is "str(...)".
+
+
+
+ Example:
+
+
+ # Also accepts a float value for the first string argument -
+# it is converted to "2.5"
+t = RBA::Text::new(2.5, RBA::Trans::new)
+
+ Conversion constructors
+
+ Conversion constructors are constructors that take an object of a
+different class and convert it to the target class.
+Conversion constructors are used implicitly in applicable cases
+to convert one type to the type requested by the argument.
+
+
+ For example, in the following code, the Region object's "+" operator
+ is used. This expects a Region object as the second parameter, but as
+ there is conversion constructor available which converts a Box to
+ a Region, it is possible to use a Box directly:
+
+
+ r = RBA::Region::new(RBA::Box::new(0, 0, 1000, 2000))
+r += RBA::Box::new(3000, 0, 4000, 2000)
+
+ Implicit constructor from lists
+
+
+ When an object is expected for an argument and a list is given,
+ the object constructor is called with the arguments from the list.
+ This specifically allows using size-2 lists instead of Point or
+ Vector arguments. In Python, a "list" can also be a tuple.
+
+
+
+ In the following example, this mechanism is used for
+ the polygon point list which is expected to be an array
+ of Point objects, but can use size-2 arrays instead.
+ Also, the "moved" method expects a Vector, but here
+ as well, size-2 arrays can be used instead:
+
+
+ pts = [ [ 0, 0 ], [ 0, 1000 ], [ 1000, 0 ] ]
+poly = RBA::Polygon::new(pts)
+poly = poly.moved([ 100, 200 ])
+
Constness