Class: Cloudsheet::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudsheet/map.rb

Instance Method Summary collapse

Constructor Details

#initializeMap

Returns a new instance of Map.



3
4
5
# File 'lib/cloudsheet/map.rb', line 3

def initialize
  @data = {}
end

Instance Method Details

#[](i) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/cloudsheet/map.rb', line 11

def [](i)
  if @data[i]
    @data[i]
  else
    Mapping.new(i)
  end
end

#[]=(i, val) ⇒ Object



7
8
9
# File 'lib/cloudsheet/map.rb', line 7

def []=(i,val)
  @data[i] = val
end

#read(i, d) ⇒ Object



19
20
21
22
# File 'lib/cloudsheet/map.rb', line 19

def read(i, d)
  return nil unless d
  self[i].read.call d
end

#write(i, d) ⇒ Object



24
25
26
27
# File 'lib/cloudsheet/map.rb', line 24

def write(i, d)
  return "" unless d
  self[i].write.call d
end