Class: Shoes::Mask

Inherits:
Object show all
Defined in:
lib/shoes/mask.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, &blk) ⇒ Mask

Returns a new instance of Mask.



3
4
5
6
7
8
9
# File 'lib/shoes/mask.rb', line 3

def initialize app, &blk
  @app = app
  @parent = app.cslot
  @real = nil
  app.cslot.masked = true
  mask_block_call &blk
end

Instance Attribute Details

#contentsObject

Returns the value of attribute contents.



12
13
14
# File 'lib/shoes/mask.rb', line 12

def contents
  @contents
end

#parentObject (readonly)

Returns the value of attribute parent.



11
12
13
# File 'lib/shoes/mask.rb', line 11

def parent
  @parent
end

#realObject

Returns the value of attribute real.



12
13
14
# File 'lib/shoes/mask.rb', line 12

def real
  @real
end

Instance Method Details

#clear(&blk) ⇒ Object



14
15
16
17
18
19
# File 'lib/shoes/mask.rb', line 14

def clear &blk
  @real.clear
  @contents.each &:clear
  mask_block_call &blk
  Shoes.call_back_procs @app
end

#mask_block_call(&blk) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/shoes/mask.rb', line 21

def mask_block_call &blk
  @contents = []
  @app.cmask = self
  blk.call if blk
  @app.cmask = nil
  @contents.each &:hide
end