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.
45 46 47 |
# File 'lib/uuids/base/has_uuids.rb', line 45 def uuid uuids.map(&:value).sort.first end |
#uuid=(value) ⇒ Object
Assigns a new uuid to the record.
57 58 59 |
# File 'lib/uuids/base/has_uuids.rb', line 57 def uuid=(value) uuids.new value: value end |
#uuids=(*values) ⇒ Object
Assigns a list of new uuids to the record.
76 77 78 |
# File 'lib/uuids/base/has_uuids.rb', line 76 def uuids=(*values) values.flatten.each { |value| self.uuid = value } end |