Class: R::NullCheckResult

Inherits:
Object
  • Object
show all
Defined in:
lib/R_interface/ruby_extensions.rb

Overview

Result object for nil.is__null so that nil.is__null.unboxed_get(0) => true.

Instance Method Summary collapse

Constructor Details

#initialize(bool) ⇒ NullCheckResult

Returns a new instance of NullCheckResult.



232
233
234
# File 'lib/R_interface/ruby_extensions.rb', line 232

def initialize(bool)
  @bool = bool
end

Instance Method Details

#unboxed_get(_index = nil) ⇒ Object



235
236
237
# File 'lib/R_interface/ruby_extensions.rb', line 235

def unboxed_get(_index = nil)
  @bool
end

#|(other) ⇒ Object

For (nil.is__null | x).unboxed_get(0): true | x => true; false | x => x



239
240
241
# File 'lib/R_interface/ruby_extensions.rb', line 239

def |(other)
  @bool ? self : other
end