Module: Uuids::Base::HasUuids
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/uuids/base/has_uuids.rb
Overview
Defines methods to be added by the has_uuids
class helper.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#uuid ⇒ String
Returns the first UUID (sorted as a string) for the record.
-
#uuid=(value) ⇒ Object
Assigns a new uuid to the record.
-
#uuids=(*values) ⇒ Object
Assigns a list of new uuids to the record.
Instance Method Details
#uuid ⇒ String
Returns the first UUID (sorted as a string) for the record.
62 63 64 |
# File 'lib/uuids/base/has_uuids.rb', line 62 def uuid uuids.map(&:value).sort.first end |
#uuid=(value) ⇒ Object
Assigns a new uuid to the record.
75 76 77 |
# File 'lib/uuids/base/has_uuids.rb', line 75 def uuid=(value) uuids.new value: value end |
#uuids=(*values) ⇒ Object
Assigns a list of new uuids to the record.
95 96 97 |
# File 'lib/uuids/base/has_uuids.rb', line 95 def uuids=(*values) values.flatten.each { |value| self.uuid = value } end |