Class: Object

Inherits:
BasicObject
Defined in:
lib/primitive_wrapper.rb

Overview

Standard Object upgrades

Instance Method Summary collapse

Instance Method Details

#prim_valueObject



19
20
21
# File 'lib/primitive_wrapper.rb', line 19

def prim_value
  self
end

#pw_copyObject



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

def pw_copy
  self.dup rescue self
end

#to_wrapperObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/primitive_wrapper.rb', line 25

def to_wrapper
  return Bit.new(nil) if self.nil?
  return Bool.new(true) if self==true
  return Bool.new(false) if self==false
  return Int.new(self) if self.kind_of? Integer
  return FloatW.new(self) if self.kind_of? Float
  return Number.new(self) if self.kind_of? Numeric
  return Datum.new(self) if self.kind_of? String
  return SymbolW.new(self) if self.kind_of? Symbol
  return Property.new(self) if self.kind_of? Hash
  return XArray.new(self) if self.kind_of? Array
  return XRange.new(self) if self.kind_of? Range
  return Fraction.new(self) if self.kind_of? Rational
  return Value.new(self)
end

#typeObject



13
14
15
# File 'lib/primitive_wrapper.rb', line 13

def type
  self.class
end

#type_of?(cls) ⇒ Boolean

Returns:

  • (Boolean)


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

def type_of?(cls)
  kind_of? cls
end

#wrapped?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/primitive_wrapper.rb', line 22

def wrapped?
  false
end