solnic/virtus — Issue #27: Virtus cannot be used in Modules
Author: postmodern
Created: 2011-11-07 23:42:45+00:00
State: open

I wanted to try replacing [parameters](http://github.com/postmodern/parameters) with Virtus. One of the features that Parameters has is being able to be used in Mixin modules, so that when the Mixin is included the parameters are added to the class. Virtus appears to only work with Classes.

module Test
include Virtus

attribute :name, String
end

NoMethodError: undefined method `superclass' for Test:Module
/home/hal/.rvm/gems/ruby-1.9.3-p0/gems/virtus-0.0.9/lib/virtus/class_methods.rb:71:in `attributes'
/home/hal/.rvm/gems/ruby-1.9.3-p0/gems/virtus-0.0.9/lib/virtus/class_methods.rb:115:in `virtus_add_attribute'
/home/hal/.rvm/gems/ruby-1.9.3-p0/gems/virtus-0.0.9/lib/virtus/class_methods.rb:48:in `attribute'
(ripl):7:in `'