lib/myjohndeere/json_attributes.rb in myjohndeere-0.0.5 vs lib/myjohndeere/json_attributes.rb in myjohndeere-0.0.6
- old
+ new
@@ -27,9 +27,17 @@
val = Time.parse(val) rescue val
end
instance_variable_set("@#{attrib.underscore}", val)
end
end
+
+ def to_s
+ the_hash = {}
+ self.class.json_attributes.each do |attrib|
+ the_hash[attrib] = send(attrib.to_s.underscore)
+ end
+ return "#{self.class}: #{the_hash}"
+ end
end
def self.included(receiver)
receiver.extend ClassMethods
receiver.send :include, InstanceMethods
\ No newline at end of file