Module: Reight::Activatable
Instance Method Summary collapse
- #activated(&block) ⇒ Object
- #activated! ⇒ Object
- #active=(active) ⇒ Object
- #active? ⇒ Boolean
- #initialize ⇒ Object
Instance Method Details
#activated(&block) ⇒ Object
17 18 19 |
# File 'lib/reight/helpers.rb', line 17 def activated(&block) @activateds.push block if block end |
#activated! ⇒ Object
21 22 23 |
# File 'lib/reight/helpers.rb', line 21 def activated!() @activateds.each {_1.call active} end |
#active=(active) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/reight/helpers.rb', line 8 def active=(active) active = !!active return if active == @active @active = active activated! end |
#active? ⇒ Boolean
15 |
# File 'lib/reight/helpers.rb', line 15 def active? = @active |
#initialize ⇒ Object
3 4 5 6 |
# File 'lib/reight/helpers.rb', line 3 def initialize(...) super @active, @activateds = false, [] end |