Module: Dry
- Defined in:
- lib/dry/struct.rb,
lib/dry/struct/sum.rb,
lib/dry/struct/value.rb,
lib/dry/struct/errors.rb,
lib/dry/struct/hashify.rb,
lib/dry/struct/printer.rb,
lib/dry/struct/version.rb,
lib/dry/struct/compiler.rb,
lib/dry/struct/constructor.rb,
lib/dry/struct/struct_builder.rb,
lib/dry/struct/class_interface.rb,
lib/dry/struct/extensions/pretty_print.rb
Defined Under Namespace
Modules: Types Classes: Struct
Class Method Summary collapse
-
.Struct(attributes = Dry::Core::Constants::EMPTY_HASH, &block) ⇒ Dry::Struct
Constructor method for easily creating a Struct.
Class Method Details
.Struct(attributes = Dry::Core::Constants::EMPTY_HASH, &block) ⇒ Dry::Struct
Constructor method for easily creating a Struct.
30 31 32 33 34 35 |
# File 'lib/dry/struct.rb', line 30 def self.Struct(attributes = Dry::Core::Constants::EMPTY_HASH, &block) Class.new(Dry::Struct) do attributes.each { |a, type| attribute a, type } module_eval(&block) if block end end |