Module: Messaging::Message::Build
- Defined in:
- lib/messaging/message.rb
Instance Method Summary collapse
- #build(data = nil, metadata = nil) ⇒ Object
- #build_metadata(metadata) ⇒ Object
- #set_attributes(instance, data) ⇒ Object
Instance Method Details
#build(data = nil, metadata = nil) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/messaging/message.rb', line 68 def build(data=nil, =nil) data ||= {} ||= {} = () new.tap do |instance| # Needed because Schema::DataStructure classes are expected # to support this protocol, but Message overrides build instance.transform_read(data) # set_attributes(instance, data) instance. = end end |
#build_metadata(metadata) ⇒ Object
89 90 91 92 93 94 95 |
# File 'lib/messaging/message.rb', line 89 def () if .nil? Metadata.new else Metadata.build(.to_h) end end |
#set_attributes(instance, data) ⇒ Object
85 86 87 |
# File 'lib/messaging/message.rb', line 85 def set_attributes(instance, data) SetAttributes.(instance, data) end |