Class: Workbook::NilValue

Inherits:
Object
  • Object
show all
Defined in:
lib/workbook/nil_value.rb

Overview

Used in cases col or rowspans are used

Instance Method Summary collapse

Constructor Details

#initialize(reason) ⇒ NilValue

initialize this special nilvalue with a reason

Parameters:

  • reason (String)

    (currently only :covered, in case this cell is coverd because an adjecant cell spans over it)



10
11
12
# File 'lib/workbook/nil_value.rb', line 10

def initialize reason
  self.reason= reason
end

Instance Method Details

#<=>(v) ⇒ Object



20
21
22
# File 'lib/workbook/nil_value.rb', line 20

def <=> v
  value <=> v
end

#reasonObject



24
25
26
# File 'lib/workbook/nil_value.rb', line 24

def reason
  @reason
end

#reason=(reason) ⇒ Object

set the reason why this value is nil



29
30
31
32
33
34
35
# File 'lib/workbook/nil_value.rb', line 29

def reason= reason
  if reason == :covered
    @reason = reason
  else
    raise "invalid reason given"
  end
end

#valueNilClass

returns the value of itself (nil)

Returns:

  • (NilClass)

    nil



16
17
18
# File 'lib/workbook/nil_value.rb', line 16

def value
  nil
end