Class: Booth::ToStruct

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/booth/to_struct.rb

Overview

Converts a Hash to a Data object.

Instance Method Summary collapse

Instance Method Details

#callObject



10
11
12
13
14
15
16
# File 'lib/booth/to_struct.rb', line 10

def call
  ::Data.define(*attributes.keys) do
    def self.inspect
      "<Data :#{members.join(', :')}>"
    end
  end.new(**attributes)
end