Class: Ohm::Types::Base
- Inherits:
- BasicObject
- Extended by:
- Forwardable
- Defined in:
- lib/ohm/contrib/typecast.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Exception
Constant Summary collapse
- @@delegation_blacklist =
[ :==, :to_s, :initialize, :inspect, :object_id, :__send__, :__id__, :respond_to? ]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.[](value) ⇒ Object
39 40 41 42 43 |
# File 'lib/ohm/contrib/typecast.rb', line 39 def self.[](value) return empty if value.to_s.empty? new(value) end |
.delegate_to(klass, except = @@delegation_blacklist) ⇒ Object
49 50 51 52 |
# File 'lib/ohm/contrib/typecast.rb', line 49 def self.delegate_to(klass, except = @@delegation_blacklist) methods = klass.public_instance_methods.map(&:to_sym) - except def_delegators :object, *methods end |
.empty ⇒ Object
45 46 47 |
# File 'lib/ohm/contrib/typecast.rb', line 45 def self.empty defined?(self::RAW) ? self::RAW.new : nil end |
Instance Method Details
#inspect ⇒ Object
54 55 56 |
# File 'lib/ohm/contrib/typecast.rb', line 54 def inspect @raw.inspect end |