Skip to content

Commit

Permalink
allow options to marshal specific attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
maccman committed Apr 6, 2010
1 parent e02ee3e commit e677628
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/supermodel/marshal.rb
Expand Up @@ -32,7 +32,7 @@ def load
end
end
data.each do |klass, records|
klass.marshal_records(records)
klass.marshal_records = records
end
true
end
Expand Down Expand Up @@ -60,7 +60,7 @@ def self.included(base)
end

def marshal_dump
serializable_hash
serializable_hash(self.class.marshal)
end

def marshal_load(atts)
Expand All @@ -70,10 +70,19 @@ def marshal_load(atts)
end

module ClassMethods
def marshal_records(records = nil)
@records = records if records
@records
def marshal(options = nil)
@marshal = options if options
@marshal ||= {}
end
alias_method :marshal=, :marshal

def marshal_records=(records)
@records = records
end

def marshal_records
@records
end
end
end
end
Expand Down

0 comments on commit e677628

Please sign in to comment.