Class: Sycsvpro::NotAvailable
- Inherits:
-
Object
- Object
- Sycsvpro::NotAvailable
- Defined in:
- lib/sycsvpro/not_available.rb
Overview
The NotAvailable class is an Eigenclass and used to represent a missing value. It will return if used in any expression always not available.
na = NotAvailable
na + 1 -> na
1 + na -> na
Constant Summary collapse
- NA =
The string representation of NotAvailable
"NA"
Class Method Summary collapse
-
.coerce(value) ⇒ Object
Catches all expressions where na is not the first argument and swaps value and na, so na is first argument.
-
.method_missing(name, *args, &block) ⇒ Object
Catches all expressions where na is the first argument.
-
.respond_to?(name) ⇒ Boolean
Checks whether SpreadSheet responds to ‘name’.
-
.to_s ⇒ Object
Returns NA as the string representation.
Class Method Details
.coerce(value) ⇒ Object
Catches all expressions where na is not the first argument and swaps value and na, so na is first argument
25 26 27 |
# File 'lib/sycsvpro/not_available.rb', line 25 def coerce(value) [self,value] end |
.method_missing(name, *args, &block) ⇒ Object
Catches all expressions where na is the first argument
19 20 21 |
# File 'lib/sycsvpro/not_available.rb', line 19 def method_missing(name, *args, &block) self end |
.respond_to?(name) ⇒ Boolean
Checks whether SpreadSheet responds to ‘name’. The methods :to_ary and :to_str are excluded
31 32 33 34 35 |
# File 'lib/sycsvpro/not_available.rb', line 31 def respond_to?(name) return false if name == :to_ary return false if name == :to_str super end |
.to_s ⇒ Object
Returns NA as the string representation
38 39 40 |
# File 'lib/sycsvpro/not_available.rb', line 38 def to_s NA end |