Class: Dis::Layers
Overview
Dis Layers
Represents a collection of layers.
Instance Method Summary collapse
-
#clear! ⇒ Object
Clears all layers from the collection.
-
#delayed ⇒ Object
Returns a new instance containing only the delayed layers.
-
#delayed? ⇒ Boolean
Returns true if one or more delayed layers exist.
-
#each(&block) ⇒ Object
Iterates over the layers.
-
#immediate ⇒ Object
Returns a new instance containing only the immediate layers.
-
#immediate? ⇒ Boolean
Returns true if one or more immediate layers exist.
-
#initialize(layers = []) ⇒ Layers
constructor
A new instance of Layers.
-
#readonly ⇒ Object
Returns a new instance containing only the readonly layers.
-
#readonly? ⇒ Boolean
Returns true if one or more readonly layers exist.
-
#writeable ⇒ Object
Returns a new instance containing only the writeable layers.
-
#writeable? ⇒ Boolean
Returns true if one or more writeable layers exist.
Constructor Details
#initialize(layers = []) ⇒ Layers
Returns a new instance of Layers.
10 11 12 |
# File 'lib/dis/layers.rb', line 10 def initialize(layers = []) @layers = layers end |
Instance Method Details
#clear! ⇒ Object
Clears all layers from the collection.
18 19 20 |
# File 'lib/dis/layers.rb', line 18 def clear! @layers = [] end |
#delayed ⇒ Object
Returns a new instance containing only the delayed layers.
28 29 30 |
# File 'lib/dis/layers.rb', line 28 def delayed self.class.new select(&:delayed?) end |
#delayed? ⇒ Boolean
Returns true if one or more delayed layers exist.
33 34 35 |
# File 'lib/dis/layers.rb', line 33 def delayed? delayed.any? end |
#each(&block) ⇒ Object
Iterates over the layers.
23 24 25 |
# File 'lib/dis/layers.rb', line 23 def each(&block) @layers.each { |layer| block.call(layer) } end |
#immediate ⇒ Object
Returns a new instance containing only the immediate layers.
38 39 40 |
# File 'lib/dis/layers.rb', line 38 def immediate self.class.new select(&:immediate?) end |
#immediate? ⇒ Boolean
Returns true if one or more immediate layers exist.
43 44 45 |
# File 'lib/dis/layers.rb', line 43 def immediate? immediate.any? end |
#readonly ⇒ Object
Returns a new instance containing only the readonly layers.
48 49 50 |
# File 'lib/dis/layers.rb', line 48 def readonly self.class.new select(&:readonly?) end |
#readonly? ⇒ Boolean
Returns true if one or more readonly layers exist.
53 54 55 |
# File 'lib/dis/layers.rb', line 53 def readonly? readonly.any? end |
#writeable ⇒ Object
Returns a new instance containing only the writeable layers.
58 59 60 |
# File 'lib/dis/layers.rb', line 58 def writeable self.class.new select(&:writeable?) end |
#writeable? ⇒ Boolean
Returns true if one or more writeable layers exist.
63 64 65 |
# File 'lib/dis/layers.rb', line 63 def writeable? writeable.any? end |