Module: Mongoid::Sequence::ClassMethods
- Defined in:
- lib/mongoid-sequence2/sequence.rb
Instance Attribute Summary collapse
-
#sequence_fields ⇒ Object
Returns the value of attribute sequence_fields.
Instance Method Summary collapse
- #get_sequence(field) ⇒ Object
- #next_sequence(field, step = 1) ⇒ Object
- #sequence(fieldname) ⇒ Object
Instance Attribute Details
#sequence_fields ⇒ Object
Returns the value of attribute sequence_fields.
14 15 16 |
# File 'lib/mongoid-sequence2/sequence.rb', line 14 def sequence_fields @sequence_fields end |
Instance Method Details
#get_sequence(field) ⇒ Object
26 27 28 |
# File 'lib/mongoid-sequence2/sequence.rb', line 26 def get_sequence(field) Sequences.get_sequence(self.name.underscore, field) end |
#next_sequence(field, step = 1) ⇒ Object
21 22 23 24 |
# File 'lib/mongoid-sequence2/sequence.rb', line 21 def next_sequence(field, step = 1) step ||= 1 Sequences.get_next_sequence(self.name.underscore, field, step) end |
#sequence(fieldname) ⇒ Object
16 17 18 19 |
# File 'lib/mongoid-sequence2/sequence.rb', line 16 def sequence(fieldname) self.sequence_fields ||= [] self.sequence_fields << fieldname end |