Module: ActsAsLiving::MethodsDefiner::InstanceMethods
- Defined in:
- lib/acts_as_living/methods_definer.rb
Instance Method Summary collapse
- #dead? ⇒ Boolean
- #dead_or_dying? ⇒ Boolean
- #dying? ⇒ Boolean
- #first_stage? ⇒ Boolean
- #klass_phases_for(stage) ⇒ Object
- #klass_phases_with_ranges ⇒ Object
- #klass_stages ⇒ Object
- #locked?(&block) ⇒ Boolean
- #next_stage ⇒ Object
- #phase_changed? ⇒ Boolean
- #phases ⇒ Object
- #phases_ended ⇒ Object
- #phases_started ⇒ Object
- #previous_stage ⇒ Object
- #stage_after(stage) ⇒ Object
- #stage_before(stage) ⇒ Object
- #stages ⇒ Object
- #to_next_stage ⇒ Object
- #to_next_stage! ⇒ Object
- #to_previous_stage ⇒ Object
- #to_previous_stage! ⇒ Object
Instance Method Details
#dead? ⇒ Boolean
59 60 61 |
# File 'lib/acts_as_living/methods_definer.rb', line 59 def dead? self.class.death == stage end |
#dead_or_dying? ⇒ Boolean
63 64 65 |
# File 'lib/acts_as_living/methods_definer.rb', line 63 def dead? || end |
#dying? ⇒ Boolean
51 52 53 |
# File 'lib/acts_as_living/methods_definer.rb', line 51 def self.class.(stage) end |
#first_stage? ⇒ Boolean
55 56 57 |
# File 'lib/acts_as_living/methods_definer.rb', line 55 def first_stage? self.class.first_stage?(stage) end |
#klass_phases_for(stage) ⇒ Object
71 72 73 |
# File 'lib/acts_as_living/methods_definer.rb', line 71 def klass_phases_for(stage) self.class.phases_for(stage) end |
#klass_phases_with_ranges ⇒ Object
67 68 69 |
# File 'lib/acts_as_living/methods_definer.rb', line 67 def klass_phases_with_ranges self.class.phases_with_ranges end |
#klass_stages ⇒ Object
75 76 77 |
# File 'lib/acts_as_living/methods_definer.rb', line 75 def klass_stages self.class.stages end |
#locked?(&block) ⇒ Boolean
79 80 81 82 83 |
# File 'lib/acts_as_living/methods_definer.rb', line 79 def locked?(&block) return unless block @locked_on.to_set.intersect? [stage, stage_was].to_set end |
#next_stage ⇒ Object
35 36 37 |
# File 'lib/acts_as_living/methods_definer.rb', line 35 def next_stage stage_after(stage) if stage end |
#phase_changed? ⇒ Boolean
89 90 91 |
# File 'lib/acts_as_living/methods_definer.rb', line 89 def phase_changed? klass_phases_for(stage) != klass_phases_for(stage_was) end |
#phases ⇒ Object
85 86 87 |
# File 'lib/acts_as_living/methods_definer.rb', line 85 def phases klass_phases_for(stage) end |
#phases_ended ⇒ Object
97 98 99 |
# File 'lib/acts_as_living/methods_definer.rb', line 97 def phases_ended klass_phases_for(stage_was) - klass_phases_for(stage) end |
#phases_started ⇒ Object
93 94 95 |
# File 'lib/acts_as_living/methods_definer.rb', line 93 def phases_started klass_phases_for(stage) - klass_phases_for(stage_was) end |
#previous_stage ⇒ Object
47 48 49 |
# File 'lib/acts_as_living/methods_definer.rb', line 47 def previous_stage stage_before(stage) end |
#stage_after(stage) ⇒ Object
15 16 17 |
# File 'lib/acts_as_living/methods_definer.rb', line 15 def stage_after(stage) self.class.stage_after(stage) end |
#stage_before(stage) ⇒ Object
23 24 25 |
# File 'lib/acts_as_living/methods_definer.rb', line 23 def stage_before(stage) self.class.stage_before(stage) end |
#stages ⇒ Object
19 20 21 |
# File 'lib/acts_as_living/methods_definer.rb', line 19 def stages self.class.stages end |
#to_next_stage ⇒ Object
27 28 29 |
# File 'lib/acts_as_living/methods_definer.rb', line 27 def to_next_stage update(stage: next_stage) end |
#to_next_stage! ⇒ Object
31 32 33 |
# File 'lib/acts_as_living/methods_definer.rb', line 31 def to_next_stage! update!(stage: next_stage) end |
#to_previous_stage ⇒ Object
39 40 41 |
# File 'lib/acts_as_living/methods_definer.rb', line 39 def to_previous_stage update(stage: previous_stage) end |
#to_previous_stage! ⇒ Object
43 44 45 |
# File 'lib/acts_as_living/methods_definer.rb', line 43 def to_previous_stage! update!(stage: previous_stage) end |