Class: Morpher::Newtype

Inherits:
Module
  • Object
show all
Defined in:
lib/morpher/newtype.rb

Overview

Generator for primitive wrappers

Instance Method Summary collapse

Instance Method Details

#included(host) ⇒ Object

rubocop:disable Metrics/MethodLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/morpher/newtype.rb', line 9

def included(host)
  transform = transform()

  host.class_eval do
    include Adamantium::Flat, Concord::Public.new(:value)

    const_set(
      :TRANSFORM,
      Transform::Sequence.new(
        [
          transform,
          Transform::Success.new(public_method(:new))
        ]
      )
    )
  end
end