Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/primitive_wrapper.rb
Overview
Standard Object upgrades
Instance Method Summary collapse
- #prim_value ⇒ Object
- #pw_copy ⇒ Object
- #to_wrapper ⇒ Object
- #type ⇒ Object
- #type_of?(cls) ⇒ Boolean
- #wrapped? ⇒ Boolean
Instance Method Details
#prim_value ⇒ Object
19 20 21 |
# File 'lib/primitive_wrapper.rb', line 19 def prim_value self end |
#pw_copy ⇒ Object
16 17 18 |
# File 'lib/primitive_wrapper.rb', line 16 def pw_copy self.dup rescue self end |
#to_wrapper ⇒ Object
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 |
#type ⇒ Object
13 14 15 |
# File 'lib/primitive_wrapper.rb', line 13 def type self.class end |
#type_of?(cls) ⇒ Boolean
10 11 12 |
# File 'lib/primitive_wrapper.rb', line 10 def type_of?(cls) kind_of? cls end |
#wrapped? ⇒ Boolean
22 23 24 |
# File 'lib/primitive_wrapper.rb', line 22 def wrapped? false end |