Class: ValueSemantics::Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/value_semantics/struct.rb

Overview

ValueSemantics equivalent of the Struct class from the Ruby standard library

Class Method Summary collapse

Class Method Details

.new { ... } ⇒ Class

Creates a new Class with ValueSemantics mixed in

Yields:

  • a block containing ValueSemantics DSL

Returns:

  • (Class)

    the newly created class



13
14
15
16
17
# File 'lib/value_semantics/struct.rb', line 13

def self.new(&block)
  klass = Class.new
  klass.include(ValueSemantics.for_attributes(&block))
  klass
end