Module: Icalendar::Marshable

Included in:
Timezone::Daylight, Timezone::Standard
Defined in:
lib/icalendar/marshable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/icalendar/marshable.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#marshal_dumpObject



9
10
11
12
13
14
15
16
# File 'lib/icalendar/marshable.rb', line 9

def marshal_dump
  instance_variables
    .reject { |ivar| self.class.transient_variables.include?(ivar) }
    .each_with_object({}) do |ivar, serialized|

    serialized[ivar] = instance_variable_get(ivar)
  end
end

#marshal_load(serialized) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/icalendar/marshable.rb', line 18

def marshal_load(serialized)
  serialized.each do |ivar, value|
    unless self.class.transient_variables.include?(ivar)
      instance_variable_set(ivar, value)
    end
  end
end