Accessing fields from class

Hello,
what is the correct usage of field_accessor and field_reader?

I am calling a java class in my project, that is originally written in
Ruby and has been transferred using “jrubyc --javac myclass.rb”. In
myclass.rb I use attr_accessor.

attr_accessor does obviously not work in a java class file. So it is
recommended to use field_accessor or field_reader instead. But the
result is an error “NameError: cannot initialize Java class”. So what is
the correct way to make a field accessible in java classes?

Thanks Roderich

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