Created
July 16, 2009 06:25
-
-
Save fauxparse/148261 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeClass < ActiveRecord::Base | |
| def object_from_yaml_with_dmatrix_support(string) | |
| if string.is_a?(String) && string =~ /^Linalg\:\:DMatrix/ | |
| eval string | |
| else | |
| object_from_yaml_without_dmatrix_support(string) | |
| end | |
| end | |
| alias_method_chain :object_from_yaml, :dmatrix_support | |
| end | |
| class Linalg::DMatrix | |
| def to_yaml | |
| "Linalg::DMatrix#{to_a.inspect}" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment