title: attr_accessor strongly typed Ruby on Rails
body: <p>Just wondering if anyone can shed some light on the basics of getter setters in Ruby on Rails with a view on strongly typed. I am very new to ruby on rails and predominately have a good understanding of .NET.</p>
  
  <p>For example, let's consider we have a .net class called Person</p>
  
  <pre><code>class Person
  {
   public string Firstname{get;set;}
   public string Lastname{get;set;}
   public Address HomeAddress{get;set;}
  }
  
  class Address
  {
   public string AddressLine1{get;set;}
   public string City{get;set;}
   public string Country{get;set;}
  }
  </code></pre>
  
  <p>In Ruby, I would write this as</p>
  
  <pre><code>class Person
   attr_accessor :FirstName
   attr_accessor :LastName
   attr_accessor :HomeAddress
  end
  
  class Address
   attr_accessor :AddressLine1
   attr_accessor :City
   attr_accessor :Country
  end
  </code></pre>
  
  <p>Looking at the Ruby version of the Person class how do I specify the types for the accessor methods FirstName, LastName and HomeAddress? If I were to consume this class I could feed any type into HomeAddress but I want this accessor method to accept only the TYPE Address. </p>
  
  <p>Any suggestions?</p>