Class: DumpableProc
Class Method Summary
collapse
Instance Method Summary
collapse
#instance_call, #source_file, #source_line, #source_location, #to_proc, #to_yaml_string
Class Method Details
._load(data) ⇒ Object
19
20
21
22
|
# File 'lib/dumpable_proc.rb', line 19
def self._load ( data )
klass, str = Marshal.load(data)
klass.new(str)
end
|
9
10
11
12
13
|
# File 'lib/dumpable_proc.rb', line 9
def self.new ( str )
pr = super(&eval("proc { #{str} }"))
pr.instance_eval { @str = str.freeze }
pr
end
|
Instance Method Details
#_dump(depth) ⇒ Object
15
16
17
|
# File 'lib/dumpable_proc.rb', line 15
def _dump ( depth )
Marshal.dump([self.class, @str])
end
|
24
25
26
|
# File 'lib/dumpable_proc.rb', line 24
def to_s
@str
end
|