Class: Ohm::Types::Primitive

Inherits:
BasicObject
Defined in:
lib/ohm/contrib/typecast.rb

Direct Known Subclasses

Date, Decimal, Float, Integer, String, Time

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Primitive

Returns a new instance of Primitive.



16
17
18
# File 'lib/ohm/contrib/typecast.rb', line 16

def initialize(value)
  @raw = value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object (protected)



37
38
39
# File 'lib/ohm/contrib/typecast.rb', line 37

def method_missing(meth, *args, &blk)
  object.send(meth, *args, &blk)
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
# File 'lib/ohm/contrib/typecast.rb', line 28

def ==(other)
  to_s == other.to_s
end

#inspectObject



24
25
26
# File 'lib/ohm/contrib/typecast.rb', line 24

def inspect
  object
end

#to_sObject



20
21
22
# File 'lib/ohm/contrib/typecast.rb', line 20

def to_s
  @raw.to_s
end