Class Circle

With co-ordinates x y that are in Domieszka module I want to do ray r in
circle class. Are there some modules to serve co-ordinates or is there
the simplest way to do?

module Domieszka
attr_accessor :x, :y

def inspect
“You are in: #{@x} #{@y}”

def moveto(x,y)
@x = x
@y = y
return x,y

ray that has some length:) not co-ordinates

Try this:

Circle =, :y)

c =, 15)
puts c.inspect

A more full-featured example:

Circle =, :y, :r)

class Circle
def move_to(x, y)
self.x = x
self.y = y

c =, 0, 10)
puts c.inspect
c.move_to(5, 7)
puts c.inspect

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs