Module: HybridStateModel::QueryMethods::ClassMethods

Defined in:
lib/hybrid_state_model/query_methods.rb

Instance Method Summary collapse

Instance Method Details

#in_micro(*states) ⇒ Object



15
16
17
18
# File 'lib/hybrid_state_model/query_methods.rb', line 15

def in_micro(*states)
  field = state_machine.micro_field
  where(field => states.map(&:to_sym))
end

#in_primary(*states) ⇒ Object



10
11
12
13
# File 'lib/hybrid_state_model/query_methods.rb', line 10

def in_primary(*states)
  field = state_machine.primary_field
  where(field => states.map(&:to_sym))
end

#with_microObject



29
30
31
32
# File 'lib/hybrid_state_model/query_methods.rb', line 29

def with_micro
  field = state_machine.micro_field
  where.not(field => nil)
end

#with_primary_and_micro(primary:, micro:) ⇒ Object



20
21
22
# File 'lib/hybrid_state_model/query_methods.rb', line 20

def with_primary_and_micro(primary:, micro:)
  in_primary(primary).in_micro(micro)
end

#without_microObject



24
25
26
27
# File 'lib/hybrid_state_model/query_methods.rb', line 24

def without_micro
  field = state_machine.micro_field
  where(field => nil)
end