Class: Ohm::Types::Primitive

Inherits:
Base
  • Object
show all
Defined in:
lib/ohm/contrib/typecast.rb

Direct Known Subclasses

Date, Decimal, Float, Integer, String, Time

Instance Method Summary collapse

Methods inherited from Base

[], delegate_to, empty, #inspect

Constructor Details

#initialize(value) ⇒ Primitive



60
61
62
# File 'lib/ohm/contrib/typecast.rb', line 60

def initialize(value)
  @raw = value
end

Instance Method Details

#==(other) ⇒ Object



68
69
70
# File 'lib/ohm/contrib/typecast.rb', line 68

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

#objectObject



78
79
80
# File 'lib/ohm/contrib/typecast.rb', line 78

def object
  @raw
end

#respond_to?(method) ⇒ Boolean



72
73
74
75
76
# File 'lib/ohm/contrib/typecast.rb', line 72

def respond_to?(method)
  object.respond_to?(method)
rescue ::ArgumentError
  @raw.respond_to?(method)
end

#to_sObject



64
65
66
# File 'lib/ohm/contrib/typecast.rb', line 64

def to_s
  @raw.to_s
end