lib/active_mocker/field.rb in active_mocker-1.1.23 vs lib/active_mocker/field.rb in active_mocker-1.2.pre
- old
+ new
@@ -13,14 +13,16 @@
def to_h
{name: name, type: type, options: options}
end
+ alias_method :to_hash, :to_h
+
def create_option_methods
options.each do |opt|
key, value = opt.first
self.instance_variable_set("@#{key}", value)
- define_singleton_method(key) {instance_variable_get("@#{key}")}
+ self.class.send(:attr_accessor, key)
end
end
end