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



3
4
5
# File 'lib/icalendar/marshable.rb', line 3

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

Instance Method Details

#marshal_dumpObject



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

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



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

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