use attr_accessor instead of defining the methods manually
Merge pull request #781 from mapleoin/attr-accessor

use attr_accessor instead of defining the methods manually