Class: Drymm::Shapes::AtomicType Private

Inherits:
Concurrent::AtomicReference
  • Object
show all
Includes:
Dry::Types::Builder, Dry::Types::Decorator, Dry::Types::Type
Defined in:
lib/drymm/shapes/atomic_type.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(initial_type = Drymm::Undefined) ⇒ AtomicType

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AtomicType.



12
13
14
15
16
# File 'lib/drymm/shapes/atomic_type.rb', line 12

def initialize(initial_type = Drymm::Undefined)
  Drymm::Undefined.map(initial_type) do
    set(initial_type)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, **opts, &blk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
33
34
35
36
37
38
# File 'lib/drymm/shapes/atomic_type.rb', line 30

def method_missing(method_name, *args, **opts, &blk)
  value = get

  if value.respond_to?(method_name, true)
    value.send(method_name, *args, **opts, &blk)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = true) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


26
27
28
# File 'lib/drymm/shapes/atomic_type.rb', line 26

def respond_to_missing?(method_name, include_private = true)
  get.respond_to?(method_name, include_private) || super
end

#to_sObject Also known as: inspect

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/drymm/shapes/atomic_type.rb', line 20

def to_s
  Dry::Types::PRINTER.(get) { get.to_s }
end