Class: Object

Inherits:
BasicObject
Defined in:
lib/cellar.rb

Overview

cellar - Ruby gem to deal with cells of data in rows and columns

Author: Steve Shreeve ([email protected])

Date: October 19, 2024

TODO: • Should we failover to empty strings like this: (value || “”)

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/cellar.rb', line 16

def blank?
  respond_to?(:empty?) or return !self
  empty? or respond_to?(:strip) && strip.empty?
end

#if_blank(val) ⇒ Object



21
22
23
# File 'lib/cellar.rb', line 21

def if_blank(val)
  blank? ? val : self
end

#if_presentObject



25
26
27
# File 'lib/cellar.rb', line 25

def if_present
  blank? ? nil : self
end

#val?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/cellar.rb', line 12

def val?
  !nil?
end