Module: Workbook::Modules::RawObjectsStorage

Included in:
Format, Template
Defined in:
lib/workbook/modules/raw_objects_storage.rb

Instance Method Summary collapse

Instance Method Details

#add_raw(raw_object) ⇒ Object

A raw is a 'raw' object, representing a workbook, or cell, or whatever... in a particular format (defined by its class)



6
7
8
# File 'lib/workbook/modules/raw_objects_storage.rb', line 6

def add_raw raw_object
  raws[raw_object.class]=raw_object
end

#has_raw_for?(raw_object_class) ⇒ Boolean

Returns true if there is a template for a certain class, otherwise false

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/workbook/modules/raw_objects_storage.rb', line 11

def has_raw_for? raw_object_class
  raws.each { |tc,t| return true if tc == raw_object_class}
   return false
end

#rawsObject



25
26
27
28
# File 'lib/workbook/modules/raw_objects_storage.rb', line 25

def raws
   @raws = {} unless defined? @raws
   @raws
end

#remove_all_raws!Object



21
22
23
# File 'lib/workbook/modules/raw_objects_storage.rb', line 21

def remove_all_raws!
  @raws = {}
end

#return_raw_for(raw_object_class) ⇒ Object



16
17
18
19
# File 'lib/workbook/modules/raw_objects_storage.rb', line 16

def return_raw_for raw_object_class
 raws.each { |tc,t| return t if tc == raw_object_class}
  return nil
end