Module: Reight::Activatable

Included in:
Button, Index, Text
Defined in:
lib/reight/helpers.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


15
# File 'lib/reight/helpers.rb', line 15

def active? = @active

#initializeObject



3
4
5
6
# File 'lib/reight/helpers.rb', line 3

def initialize(...)
  super
  @active, @activateds = false, []
end