Class: ZQ::Composer::UUID4Hash
- Inherits:
-
Object
- Object
- ZQ::Composer::UUID4Hash
- Defined in:
- lib/zq/composers/uuid4.rb
Instance Method Summary collapse
- #compose(raw_data, composite = nil) ⇒ Object
-
#initialize(key = nil) ⇒ UUID4Hash
constructor
A new instance of UUID4Hash.
Constructor Details
#initialize(key = nil) ⇒ UUID4Hash
Returns a new instance of UUID4Hash.
4 5 6 |
# File 'lib/zq/composers/uuid4.rb', line 4 def initialize(key = nil) @key = key || 'uuid' end |
Instance Method Details
#compose(raw_data, composite = nil) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/zq/composers/uuid4.rb', line 7 def compose(raw_data, composite = nil) composite ||= raw_data if composite.kind_of? Hash composite[@key] = SecureRandom.uuid end composite end |