MOving objects and sticky connections between them-can it be done with Ruby?

Yes, but this is advanced programming and you should get more than limited knowledge of SketchUp, and learn Ruby basics.

Start by learning how to do simple things, before attempting complex things. Learning SKetchUp Ruby is the subject of many topics here (especially in the Ruby API sub-category. (Use forum search features, magnifying glass icon, top right.)

There is no actual built-in means of “stickiness” between lines and components in SketchUp.
This is mainly because SketchUp is a surface modeler and not CAD, so it has edges not lines.

SketchUp does have optional surface “glue to” behavior between components and face objects, for components that have this property set to use it.

If you thinking about diagramming, LayOut may be a better choice.