Skip to content

Instantly share code, notes, and snippets.

@fauxparse
Created July 16, 2009 06:25
Show Gist options
  • Save fauxparse/148261 to your computer and use it in GitHub Desktop.
Save fauxparse/148261 to your computer and use it in GitHub Desktop.
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