# Given the .i file for swig:
# %module example
# class Test {
#   public:
#   string str;
# 
#   Test() {  str = "putz"; }
# };
# 

Class Test
   attr_reader :str
   def initialize
      @str = "putz"
   end
End

--- or ---

Class Test
   def initialize
      @str = "putz"
   end
   def str
      @str
   end
End

These are equivalent and I prefere the latter.