Class: Dis::Layers

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/dis/layers.rb

Overview

Dis Layers

Represents a collection of layers.

Instance Method Summary collapse

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

#delayedObject

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.

Returns:

  • (Boolean)


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

#immediateObject

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.

Returns:

  • (Boolean)


43
44
45
# File 'lib/dis/layers.rb', line 43

def immediate?
  immediate.any?
end

#readonlyObject

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.

Returns:

  • (Boolean)


53
54
55
# File 'lib/dis/layers.rb', line 53

def readonly?
  readonly.any?
end

#writeableObject

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.

Returns:

  • (Boolean)


63
64
65
# File 'lib/dis/layers.rb', line 63

def writeable?
  writeable.any?
end